pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Einars <einars@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Chaotically weird execution plan
Date: Tue, 23 Sep 2008 22:58:10 -0400
Message-ID: <17587.1222225090@sss.pgh.pa.us> (raw)
In-Reply-To: <4f8bd5c90809231753xbcdacd2xfba4d38c2eb34faf@mail.gmail.com>
References: <4f8bd5c90809231753xbcdacd2xfba4d38c2eb34faf@mail.gmail.com>

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



view thread (6+ messages)  latest in thread

Message-ID: <17587.1222225090@sss.pgh.pa.us>
Permalink:  ../17587.1222225090@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17587.1222225090@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, einars@gmail.com
  Subject: Re: Chaotically weird execution plan
  In-Reply-To: <17587.1222225090@sss.pgh.pa.us>

* 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