Hi,
-- a
select
...
from
base_table bt
left outer join sub_table_1 st1 on (st1.base_table = bt.id)
left outer join sub_table_2 st1 on (st2.base_table = bt.id)
-- b
select
...
from
base_table bt
left outer join sub_table_1 st1 on (bt.objecttype = 1 AND
st1.base_table = bt.id)
left outer join sub_table_2 st1 on (bt.objecttype = 2 AND
st2.base_table = bt.id)
Pretend this is some stupid way of object orientation. base_table is the
base class and sub_table_x are subclasses. base_table.objecttype tells
which instance it is. Just for the sake of discussion, it could also be
like "bt.is_married_monogamous = 1 AND wife.husband = bt.id" for example.
In case b, does Postgres avoid to unnecessarily try look for respective
sub_table ? Is it worthwhile to have?
I'm on 8.3 presently. Still curious if newer versions have some
optimization here.
Best regards,
Marcus
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general