Re: Chaotically weird execution plan - Mailing list pgsql-performance

From Scott Carey
Subject Re: Chaotically weird execution plan
Date
Msg-id a1ec7d000809232107v310ca29cy28138f527947c30d@mail.gmail.com
Whole thread Raw
In response to Re: Chaotically weird execution plan  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance

Einars, you may be able to force a query plan similar to the first one, on the second data set, if you decrease the random page cost or disable bitmap scans.  If a regular index scan is faster than the bitmap scan with the same query returning the same results, there may be some benefit that can be gained with tuning further.  But it isn't likely and will depend on how likely the pages are to be in RAM versus disk.  If this is a big problem for you, it may be worth trying however.



On Tue, Sep 23, 2008 at 7:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Einars <einars@gmail.com> writes:
> When displaying information about information about an user in our
> site, I noticed an unreasonable slowdown. The culprit turned out to be
> a trivial select, which determines the number of comments left by an
> user:

I don't see anything even slightly wrong here.  Your first example pulls
15888 rows from the table in 13134 ms.  Your second example pulls 3
rows from the table in 0.121 ms --- which I rather imagine is because
those three rows are already in cache; it would take a lot longer if it
actually had to go to disk several times.

The planner's rowcount estimates are on target and it appears to be
choosing appropriate plans in each case.  It just takes longer to
process 5000 times as many rows ...

                       regards, tom lane

--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

pgsql-performance by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Intel's X25-M SSD
Next
From: "Scott Carey"
Date:
Subject: Re: Intel's X25-M SSD