From: Scott Carey <scott@richrelevance.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Einars <einars@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Chaotically weird execution plan
Date: Tue, 23 Sep 2008 21:07:11 -0700
Message-ID: <a1ec7d000809232107v310ca29cy28138f527947c30d@mail.gmail.com> (raw)
In-Reply-To: <17587.1222225090@sss.pgh.pa.us>
References: <4f8bd5c90809231753xbcdacd2xfba4d38c2eb34faf@mail.gmail.com>
<17587.1222225090@sss.pgh.pa.us>
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
>
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: scott@richrelevance.com, tgl@sss.pgh.pa.us, einars@gmail.com
Subject: Re: Chaotically weird execution plan
In-Reply-To: <a1ec7d000809232107v310ca29cy28138f527947c30d@mail.gmail.com>
* 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