From: | "Leon Mergen" <leon(at)solatis(dot)com> |
---|---|
To: | "Erik Jones" <erik(at)myemma(dot)com> |
Cc: | "Alban Hertroys" <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Conditional JOINs ? |
Date: | 2008-03-19 15:01:06 |
Message-ID: | 5eaaef180803190801u357b6a65lf49573a28016589d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3/19/08, Erik Jones <erik(at)myemma(dot)com> wrote:
> >> Excuse me for bumping this up again, but I still don't understand how
> >> to use this approach to sequentially walk through all different child
> >> tables in one select, without having to JOIN these tables all the
> >> time
> >
> > Apparently a UNION all solved this problem -- sorry for the noise.
>
>
> If you have the child tables INHERITing from the parent, then a simple
>
> SELECT parent.* FROM parent;
>
> would be equivalent to manually spelling out a UNION ALL that
> explicitly lists all of the tables.
But this will only display the information that is common for all the
child tables -- if I also want to display all the information that is
specific for the child tables, as I understand it, I have to use a
UNION ALL and merge all the child tables together this way.
The EXPLAIN of this query:
Append (cost=0.00..2169.52 rows=34376 width=94)
-> Seq Scan ON child1 (cost=0.00..1824.71 rows=34371 width=94)
-> Seq Scan ON child2 (cost=0.00..1.05 rows=5 width=56)
Regards,
Leon Mergen
From | Date | Subject | |
---|---|---|---|
Next Message | Martin Gainty | 2008-03-19 15:18:38 | Re: nntp not workiNG |
Previous Message | Erik Jones | 2008-03-19 14:12:50 | Re: Conditional JOINs ? |