Inheritance and indexes - Mailing list pgsql-hackers

From knizhnik
Subject Inheritance and indexes
Date
Msg-id 52D50C57.80704@garret.ru
Whole thread Raw
In response to Re: inherit support for foreign tables  (Shigeru Hanada <shigeru.hanada@gmail.com>)
Responses Re: Inheritance and indexes  (Marti Raudsepp <marti@juffo.org>)
List pgsql-hackers
From PostgreSQL manual:
"A serious limitation of the inheritance feature is that indexes 
(including unique constraints) and foreign key constraints only apply to 
single tables, not to their inheritance children."

But is it possible to use index for derived table at all?
Why sequential search is used for derived table in the example below:

create table base_table (x integer primary key);
create table derived_table (y integer) inherits (base_table);
insert into base_table values (1);
insert into derived_table values (2,2);
create index derived_index on derived_table(x);
explain select * from base_table where x>=0;                                          QUERY PLAN
---------------------------------------------------------------------------------------------- Append  (cost=0.14..4.56
rows=81width=4)   ->  Index Only Scan using base_table_pkey on base_table 
 
(cost=0.14..3.55 rows=80 width=4)         Index Cond: (x >= 0)   ->  Seq Scan on derived_table  (cost=0.00..1.01 rows=1
width=4)        Filter: (x >= 0)
 
(5 rows)




pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [PATCH] Negative Transition Aggregate Functions (WIP)
Next
From: Peter Geoghegan
Date:
Subject: Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE