Suppose I have a SQL Query that isn’t really “nice”.
The SQL Query has a lot inner join with long conditions, and finally a simple “where” statement.
Now suppose I make a View that corresponds to that SQL Query, excepting the final “where” statement. So that instead of make that long query, I use the view and simply add the “where” statement.
My question is the following:
Which one would have best performance?
I’m not sure if the “View” option corresonds to two sql statement, instead of the one sql statement of the first option. Or before executing the query, the “View” query is “pasted” in the more simple query and is “the same”.
No difference. The view uses the same query as the query alone.
To be different it would need to store it in a view table view don’t, they’re just queries made to look easy from the outside.