Re: Problems with ordering (can't force query planner to use an index)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Sebastjan Trepca <trepca(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Problems with ordering (can't force query planner to use an index)
Date: 2009-03-03 17:40:44
Message-ID: 603c8f070903030940n3fb1e9eay53666d06cf489469@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Mar 3, 2009 at 12:20 PM, Sebastjan Trepca <trepca(at)gmail(dot)com> wrote:
> But it's already attached in the first mail or am I missing something?
>
> If you don't see it, check this: http://pastebin.com/d71b996d0

Woops, sorry, I thought you had sent plain EXPLAIN. I see it now.

The lowest level at which I see a problem is here:

-> Index Scan using core_accessor_fresh_idx on core_accessor
(cost=0.00..5460.07 rows=2970 width=92) (actual time=0.068..54.921
rows=69312 loops=1)
Index Cond: ((slot_id = 472) AND (slot_type_id = 119) AND (label =
''::text) AND (user_id = 0) AND (role = 0) AND (publish_state >= 60))

For some reason it expect 2970 rows but gets 69312.

A good place to start is to change your default_statistics_target
value to 100 in postgresql.conf, restart postgresql, and re-ANALYZE.

...Robert

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Aaron Guyon 2009-03-03 17:52:27 Re: Postgres 8.3, four times slower queries?
Previous Message Sebastjan Trepca 2009-03-03 17:40:26 Re: Problems with ordering (can't force query planner to use an index)