pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Neil Conway <neilc@samurai.com>
To: Marc G. Fournier <scrappy@postgresql.org>
Cc: pgsql-performance@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: *very* slow query to summarize data for a month ...
Date: Mon, 10 Nov 2003 18:15:41 -0500
Message-ID: <87ptfzx1b6.fsf@mailbox.samurai.com> (raw)
In-Reply-To: <20031110160144.C727@ganymede.hub.org>
References: <20031110160144.C727@ganymede.hub.org>

"Marc G. Fournier" <scrappy@postgresql.org> writes:
> ->  Index Scan using tl_month on traffic_logs ts  (cost=0.00..30763.02 rows=8213 width=16) (actual time=0.29..5562.25 rows=462198 loops=1)
>       Index Cond: (month_trunc(runtime) = '2003-10-01 00:00:00'::timestamp without time zone)

Interesting that we get the row count estimate for this index scan so
wrong -- I believe this is the root of the problem. Hmmm... I would
guess that the optimizer stats we have for estimating the selectivity
of a functional index is pretty primitive, but I haven't looked into
it at all. Tom might be able to shed some light...

[ In the second EXPLAIN ANALYZE, ... ]

> ->  Seq Scan on traffic_logs ts  (cost=0.00..38340.72 rows=8213 width=16) (actual time=5.02..-645982.04 rows=462198 loops=1)
>       Filter: (date_trunc('month'::text, runtime) = '2003-10-01 00:00:00'::timestamp without time zone)

Uh, what? The "actual time" seems to have finished far before it has
begun :-) Is this just a typo, or does the actual output include a
negative number?

-Neil




view thread (19+ messages)  latest in thread

Message-ID: <87ptfzx1b6.fsf@mailbox.samurai.com>
Permalink:  ../87ptfzx1b6.fsf@mailbox.samurai.com/
Also on:    postgresql.org/message-id/87ptfzx1b6.fsf@mailbox.samurai.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: neilc@samurai.com, scrappy@postgresql.org, tgl@sss.pgh.pa.us
  Subject: Re: *very* slow query to summarize data for a month ...
  In-Reply-To: <87ptfzx1b6.fsf@mailbox.samurai.com>

* 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