pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gregory Stark <stark@enterprisedb.com>
To: weiping <laserlist@pgsqldb.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: different query plan because different limit # (Re: weird query plan)
Date: Wed, 06 Jun 2007 10:21:59 +0100
Message-ID: <87ejkph1zc.fsf@oxford.xeocode.com> (raw)
In-Reply-To: <46666128.7050500@pgsqldb.com>
References: <46662DE7.4030602@pgsqldb.com>
	<46663114.3000501@pgsqldb.com>
	<46666128.7050500@pgsqldb.com>

"weiping" <laserlist@pgsqldb.com> writes:

> -> Index Scan using urlusermaps_userid on wd_urlusermaps
>    (cost=0.00..6750.55 rows=1094 width=4) (actual time=1.478..16.563 rows=41 loops=1)
>    Index Cond: (userid = 219177)
>    Filter: ("share" = 1)

It's estimating 1094 rows and getting 41 rows. You might considering raising
the statistics target for that table.

Does it get accurate estimates for the number of rows for each of these?

explain analyze select * from wd_urlusermaps where userid=219177 
explain analyze select * from wd_urlusermaps where share=1

(the latter might take a while)

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com




view thread (3+ messages)

Message-ID: <87ejkph1zc.fsf@oxford.xeocode.com>
Permalink:  ../87ejkph1zc.fsf@oxford.xeocode.com/
Also on:    postgresql.org/message-id/87ejkph1zc.fsf@oxford.xeocode.com

 · 

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: stark@enterprisedb.com, laserlist@pgsqldb.com
  Subject: Re: different query plan because different limit # (Re: weird query plan)
  In-Reply-To: <87ejkph1zc.fsf@oxford.xeocode.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