Re: index usage on queries on inherited tables

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: index usage on queries on inherited tables
Date: 2011-04-29 22:53:48
Message-ID: B4595D4D-13FE-4B75-B5E0-12D340AEECAC@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Apr 27, 2011, at 11:11 PM, Joseph Shraibman <jks(at)selectacast(dot)net> wrote:
> On 04/27/2011 04:32 PM, Robert Haas wrote:
>> In the first case, PostgreSQL evidently thinks that using the indexes
>> will be slower than just ignoring them. You could find out whether
>> it's right by trying it with enable_seqscan=off.
>
> My point is that this is just a problem with inherited tables. It
> should be obvious to postgres that few rows are being returned, but in
> the inherited tables case it doesn't use indexes. This was just an
> example. In a 52 gig table I have a "select id from table limit 1 order
> by id desc" returns instantly, but as soon as you declare a child table
> it tries to seq scan all the tables.

Oh, sorry, I must have misunderstood. As Greg says, this is fixed in 9.1.

...Robert

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Robert Haas 2011-04-29 23:00:23 Re: Performance
Previous Message Claudio Freire 2011-04-29 22:03:29 Re: Performance