Re: suggestions on improving a query

From: Rajarshi Guha <rguha(at)indiana(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: suggestions on improving a query
Date: 2007-02-14 13:02:44
Message-ID: 1171458164.7305.8.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2007-02-13 at 21:44 -0500, Tom Lane wrote:
> Rajarshi Guha <rguha(at)indiana(dot)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(at)indiana(dot)edu>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
All great ideas are controversial, or have been at one time.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message filippo 2007-02-14 13:06:04 Re: backup database by cloning itself
Previous Message Ray Bannon 2007-02-14 12:43:18 Re: Union Query Improvement