About inheritance
| От | Ioannis Theoharis | 
|---|---|
| Тема | About inheritance | 
| Дата | |
| Msg-id | Pine.GSO.4.58.0408221859360.19115@calliope обсуждение исходный текст  | 
		
| Ответы | 
                	
            		Re: About inheritance
            		
            		 | 
		
| Список | 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 по дате отправления: