Re: Inheritance and indexes

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: knizhnik <knizhnik(at)garret(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inheritance and indexes
Date: 2014-01-14 11:33:32
Message-ID: CABRT9RASyXyeN2H2ffs-vqPP-LJHeGkuyAKk3wk0hcYt8zOTJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 14, 2014 at 12:07 PM, knizhnik <knizhnik(at)garret(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2014-01-14 11:46:39 Re: plpgsql.consistent_into
Previous Message Marti Raudsepp 2014-01-14 11:28:56 Re: plpgsql.consistent_into