About inheritance - Mailing list pgsql-general

From Ioannis Theoharis
Subject About inheritance
Date
Msg-id Pine.GSO.4.58.0408221859360.19115@calliope
Whole thread Raw
Responses Re: About inheritance  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general

Hi,

i have 3 tables calling father, child1, child2:

create table father(att0 int4);
create table child1() inherits(father);
create table child2() inherits(father);


i want to get all the instances of the hierarchy:
select * from father;

the explain analyze gives:

 Result
   ->  Append
         ->  Seq Scan on father
         ->  Seq Scan on child1 father



Now i drop the tables and i create them aggain without using the inherits
relationship:

create table father(att0 int4);
create table child1(att0 int4);
create table child2(att0 int4);

again i want to get all the instances of the hierarchy:
(select * from father) UNION ALL (select * from child1) UNION ALL
(select * from child2);

the explain analyze gives:

 Append
   ->  Subquery Scan "*SELECT* 1"
         ->  Seq Scan on father
   ->  Subquery Scan "*SELECT* 2"
         ->  Seq Scan on child1
   ->  Subquery Scan "*SELECT* 3"
         ->  Seq Scan on child2


Can anyone explain me the difference between these two plans?

I expekt to find the same plans because in both cases there is a union to
be done, but i see that in second case there is an additional call to a
routine. I meen the 'Subquery Scan "*SELECT* X"'

pgsql-general by date:

Previous
From: Thomas Hallgren
Date:
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions on postgresql
Next
From: Mike Nolan
Date:
Subject: Re: Unsupported 3rd-party solutions (Was: Few questions on postgresql (dblink, 2pc, clustering)) (fwd)