Re: [SQL] optimizing a query over tree-like structure

2008-09-30 Thread az
another idea i just got, to decrease the number of tables in one FROM, is to represent the first-level ORs with unions. but i'm not sure how exactly to do it: are these equivalent? FROM N,ownership,mm_N2R where ( N.dbid = ownership.N OR N.dbid = mm_N2R.left AND mm_N2R.right = ownership.R OR

[SQL] optimizing a query over tree-like structure

2008-09-30 Thread az
hi. sorry for the vague syntax used below, but the query is huge so i've tried to present it in simple terms. And sorry if i'm doing obviously stupid things, i have lots of years programming behind me but NO sql involved. i have a somewhat tree-like structure of objects that link to each other