Re: Inheritance and indexes - Mailing list pgsql-hackers

From Marti Raudsepp
Subject Re: Inheritance and indexes
Date
Msg-id CABRT9RASyXyeN2H2ffs-vqPP-LJHeGkuyAKk3wk0hcYt8zOTJQ@mail.gmail.com
Whole thread Raw
In response to Inheritance and indexes  (knizhnik <knizhnik@garret.ru>)
List pgsql-hackers
On Tue, Jan 14, 2014 at 12:07 PM, knizhnik <knizhnik@garret.ru> wrote:
> But is it possible to use index for derived table at all?

Yes, the planner will do an index scan when it makes sense.

> Why sequential search is used for derived table in the example below:

> insert into derived_table values (2,2);
> create index derived_index on derived_table(x);
> explain select * from base_table where x>=0;

With only 1 row in the table, the planner decides there's no point in
scanning the index. Try with more realistic data.

Regards,
Marti



pgsql-hackers by date:

Previous
From: Marti Raudsepp
Date:
Subject: Re: plpgsql.consistent_into
Next
From: Marko Tiikkaja
Date:
Subject: Re: plpgsql.consistent_into