Re: Query Optimizer makes a poor choice - Mailing list pgsql-general

From Tomas Vondra
Subject Re: Query Optimizer makes a poor choice
Date
Msg-id 4ED55A7F.3010306@fuzzy.cz
Whole thread Raw
In response to Re: Query Optimizer makes a poor choice  ("Tyler Hains" <thains@profitpointinc.com>)
Responses Re: Query Optimizer makes a poor choice  (Tomas Vondra <tv@fuzzy.cz>)
List pgsql-general
Hi,

what PostgreSQL version is this? That's the first thing we need to know.

On 29.11.2011 22:28, Tyler Hains wrote:
> Yes, I'm pretty sure autovacuum is enabled. Changing the query as shown
> there uses the sub-optimal index.

That doesn't mean

> I haven't had a chance to experiment with the SET STATISTICS, but that
> got me going on something interesting...

If you execute this

SELECT count(*) FROM cards WHERE card_set_id=2850;

what number do you get? How far is that from 27616, expected by the planner?

> Do these statistics look right?

No idea, that depends on your data set. And you've missed the
most_common_freqs so it's almost impossible to analyze the stats.

Tomas

pgsql-general by date:

Previous
From: Heiko Wundram
Date:
Subject: Re: Limiting number of connections to PostgreSQL per IP (not per DB/user)?
Next
From: Tomas Vondra
Date:
Subject: Re: Query Optimizer makes a poor choice