|
Self referencing table or not?
Hi there,
I am creating a DB for an application that has components called packages, folders and pages. They have slightly different properties but some are the same. Some types can be "contained within" other types.
I am wondering if it is better to have one table for each type (package, folder, page) or have one table with a type_id and a parent_id.
Which do you think will be quicker for a select statement?
e.g. (SELECT from packages UNION SELECT FROM pages UNIO....) in the first case OR (SELECT FROM components c1 LEFT JOIN components c2 ON c2.parent_id...) in the second instance.
Thanks.
__________________
Regards, Stooshie
O
|