pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reiner Dassing <dassing@wettzell.ifag.de>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Best database structure for timely ordered values
Date: Mon, 18 Dec 2000 18:13:46 +0100
Message-ID: <3A3E45CA.E5A84504@wettzell.ifag.de> (raw)
References: <200012181646.LAA29528@candle.pha.pa.us>

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



view thread (7+ messages)  latest in thread

Message-ID: <3A3E45CA.E5A84504@wettzell.ifag.de>
Permalink:  ../3A3E45CA.E5A84504@wettzell.ifag.de/
Also on:    postgresql.org/message-id/3A3E45CA.E5A84504@wettzell.ifag.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: dassing@wettzell.ifag.de, pgman@candle.pha.pa.us, tgl@sss.pgh.pa.us
  Subject: Re: Best database structure for timely ordered values
  In-Reply-To: <3A3E45CA.E5A84504@wettzell.ifag.de>
  References: <200012181646.LAA29528@candle.pha.pa.us> <3A3E45CA.E5A84504@wettzell.ifag.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox