Re: optimizing Postgres queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Teran <david(dot)teran(at)cluster9(dot)com>
Cc: Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: optimizing Postgres queries
Date: 2004-01-05 19:05:48
Message-ID: 20540.1073329548@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

David Teran <david(dot)teran(at)cluster9(dot)com> writes:
> explain result from second query:

> Seq Scan on "KEY_VALUE_META_DATA" t0 (cost=0.00..2671.16 rows=931 width
> =1068) (actual time=122.669..172.179 rows=25 loops=1)
> Filter: (("ID_VALUE" = 21094) OR ("ID_VALUE" = 21103))

The problem is evidently that the row estimate is so far off (931
estimate vs 25 actual). Have you done ANALYZE or VACUUM ANALYZE
on this table recently? If you have, I'd be interested to see the
pg_stats row for ID_VALUE. It might be that you need to increase
the statistics target for this table.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Teran 2004-01-05 19:20:49 Re: optimizing Postgres queries
Previous Message John Siracusa 2004-01-05 19:03:12 Select max(foo) and select count(*) optimization