Re: suggestions on improving a query - Mailing list pgsql-general

From Rajarshi Guha
Subject Re: suggestions on improving a query
Date
Msg-id 1171458164.7305.8.camel@localhost
Whole thread Raw
In response to Re: suggestions on improving a query  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Tue, 2007-02-13 at 21:44 -0500, Tom Lane wrote:
> Rajarshi Guha <rguha@indiana.edu> writes:
> > However the clause:
> >     dock.target = '1YC1' and
> >     dock.dockid = dockscore_plp.id
> > reduces the number of rows from 4.6M to 96K.
>
> The planner seems to be estimating about ten times that many.  Perhaps
> increasing the statistics target for dock.target would help?

My original message had a typo: I expected that it should ~ 960K, so
postgres is working as expected.

However increasing the statistics target for dock.target did lead to an
improvement in performance. Could this be because dock.target has only 5
unique values? So though the table has ~4.6M rows, each set of  ~960K
rows for dock.dockid is associated with a single value of dock.target.

Thanks,

-------------------------------------------------------------------
Rajarshi Guha <rguha@indiana.edu>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
All great ideas are controversial, or have been at one time.



pgsql-general by date:

Previous
From: Robert Grinnell
Date:
Subject: Robert Grinnell is out of the office on holiday.
Next
From: RPK
Date:
Subject: Re: PGSQL 8.2.3 Installation problem