Re: Chaotically weird execution plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Einars <einars(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Chaotically weird execution plan
Date: 2008-09-24 02:58:10
Message-ID: 17587.1222225090@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Einars <einars(at)gmail(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2008-09-24 03:01:10 Re: Chaotically weird execution plan
Previous Message Craig Ringer 2008-09-24 01:13:31 Re: Chaotically weird execution plan