About inheritance

From: Ioannis Theoharis <theohari(at)ics(dot)forth(dot)gr>
To: pgsql-general(at)postgresql(dot)org
Subject: About inheritance
Date: 2004-08-22 16:13:00
Message-ID: Pine.GSO.4.58.0408221859360.19115@calliope
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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"'

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Nolan 2004-08-22 16:25:55 Re: Unsupported 3rd-party solutions (Was: Few questions on postgresql (dblink, 2pc, clustering)) (fwd)
Previous Message Thomas Hallgren 2004-08-22 14:14:44 Re: Unsupported 3rd-party solutions (Was: Few questions on postgresql