pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Csaba Nagy <nagy@ecircle-ag.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: Searching for the cause of a bad plan
Date: Fri, 21 Sep 2007 12:08:33 -0400
Message-ID: <6175.1190390913@sss.pgh.pa.us> (raw)
In-Reply-To: <1190369024.4661.173.camel@PCD12478>
References: <1190369024.4661.173.camel@PCD12478>

Csaba Nagy <nagy@ecircle-ag.com> writes:
> Looking at Plan 2, it looks like the "limit" step is estimating wrongly
> it's cost.

The reason you get a bad plan is that this rowcount estimate is so far
off:

>                ->  Index Scan using pk_table_a on table_a ta  (cost=0.00..324786.18 rows=388532 width=16) (actual time=454.389..460.138 rows=2 loops=1)
>                      Index Cond: (a = $1)

Raising the stats target helped no doubt because it didn't overestimate
the number of rows so much...

			regards, tom lane



view thread (26+ messages)  latest in thread

Message-ID: <6175.1190390913@sss.pgh.pa.us>
Permalink:  ../6175.1190390913@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6175.1190390913@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, nagy@ecircle-ag.com
  Subject: Re: Searching for the cause of a bad plan
  In-Reply-To: <6175.1190390913@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