Subject | How does the optimizer factor in views? |
---|---|
Author | firebirdsql |
Post date | 2011-09-26T16:06:31Z |
I have the following view:
CREATE VIEW as example
AS
SELECT col1 FROM table1 INNER JOIN table2 USING(col1);
Then when I use it:
SELECT a.col1, a.col2, a.col3 FROM table1 AS a INNER JOIN example
USING (col1);
Is the optimizer smart enough to figure out that it can join table1 directly to table 2 and get col1, col2, col3? Or does it process the view first and then join it to table1 (redundant) and get col1, col2, col3?
Is it possible to display a detailed execution plan?
CREATE VIEW as example
AS
SELECT col1 FROM table1 INNER JOIN table2 USING(col1);
Then when I use it:
SELECT a.col1, a.col2, a.col3 FROM table1 AS a INNER JOIN example
USING (col1);
Is the optimizer smart enough to figure out that it can join table1 directly to table 2 and get col1, col2, col3? Or does it process the view first and then join it to table1 (redundant) and get col1, col2, col3?
Is it possible to display a detailed execution plan?