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

From Tom Lane
Subject Re: Chaotically weird execution plan
Date
Msg-id 17587.1222225090@sss.pgh.pa.us
Whole thread Raw
In response to Chaotically weird execution plan  (Einars <einars@gmail.com>)
Responses Re: Chaotically weird execution plan  ("Scott Carey" <scott@richrelevance.com>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Chaotically weird execution plan
Next
From: Tom Lane
Date:
Subject: Re: Chaotically weird execution plan