Skip site navigation (1) Skip section navigation (2)

Re: Best database structure for timely ordered values

From: Reiner Dassing <dassing(at)wettzell(dot)ifag(dot)de>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Best database structure for timely ordered values
Date: 2000-12-18 17:13:46
Message-ID: 3A3E45CA.E5A84504@wettzell.ifag.de (view raw or flat)
Thread:
Lists: pgsql-sql
Bruce Momjian wrote:
> 
> The larger problem is that count(*) doesn't use the index at all.  It
> just does a sequential scan of the heap table.

Here is another example, which is even worse:
select value from table where id=1 order by epoch desc limit 1;
to ask for the last stored value.

This request needs about 5 minutes to complete.

(But please consider that the postgres server has some other requests
to serve.
The machine running this server is an alpha server with Tru64)

The explain statements results in:

explain select * from table where id=1 order by epoche desc limit 1;
NOTICE:  QUERY PLAN:

Sort  (cost=12692.74 rows=202175 width=16)
  ->  Index Scan using wetter_pkey on table  (cost=12692.74 rows=202175
width=16)

EXPLAIN


--

   Reiner Dassing

In response to

Responses

pgsql-sql by date

Next:From: Ian Lance TaylorDate: 2000-12-18 17:33:40
Subject: Re: Re: [SQL] PostgreSQL crashes on me :(
Previous:From: Bruce MomjianDate: 2000-12-18 16:46:55
Subject: Re: Best database structure for timely ordered values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group