pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Teran <david.teran@cluster9.com>
Cc: Shridhar Daithankar <shridhar_daithankar@myrealbox.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: optimizing Postgres queries
Date: Mon, 05 Jan 2004 14:05:48 -0500
Message-ID: <20540.1073329548@sss.pgh.pa.us> (raw)
In-Reply-To: <A5055773-3FB1-11D8-A528-000A95A6F0DC@cluster9.com>
References: <4B0023AC-3F72-11D8-B3EB-000A95A6F0DC@cluster9.com>
	<200401051705.55120.shridhar_daithankar@myrealbox.com>
	<64C8DBBA-3F77-11D8-A528-000A95A6F0DC@cluster9.com>
	<200401051740.05006.shridhar_daithankar@myrealbox.com>
	<3796212E-3F79-11D8-A528-000A95A6F0DC@cluster9.com>
	<9966.1073316152@sss.pgh.pa.us>
	<9CC6A792-3FAF-11D8-A528-000A95A6F0DC@cluster9.com>
	<16230.1073328760@sss.pgh.pa.us>
	<A5055773-3FB1-11D8-A528-000A95A6F0DC@cluster9.com>

David Teran <david.teran@cluster9.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



view thread (17+ messages)  latest in thread

Message-ID: <20540.1073329548@sss.pgh.pa.us>
Permalink:  ../20540.1073329548@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20540.1073329548@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, david.teran@cluster9.com, shridhar_daithankar@myrealbox.com
  Subject: Re: optimizing Postgres queries
  In-Reply-To: <20540.1073329548@sss.pgh.pa.us>

* 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