Based on logic in the code, the example query isn't flattenable. . .

That's because whoever wrote the code made it handle only the simplest case. I doubt it would be hard to make it flatten many other types of table subqueries.

My general philosophy toward query performance issues is that I prefer massaging the query into a standard form and letting the optimizer handle it to putting in special-case logic for certain types of queries. The optimizer can do things the rest of query processing would have a difficult time with. For example, if an inner join in a subquery is flattened into the outer query, the optimizer is free to put the tables from the subquery anywhere in the join order, even if it means interspersing the subquery's tables with the outer query's tables.


                       -        Jeff Lichtman
                                [EMAIL PROTECTED]
                                Check out Swazoo Koolak's Web Jukebox at
http://swazoo.com/

Reply via email to