18.8. Hints on Using VIEWs and TEMPORARY TABLEs
Sometimes this decision is very easy for a programmer. In the Standard SQL model, the user cannot create either a VIEW or a TEMPORARY TABLE. The creation of any schema object belongs to the DBA, so the user has to use what he is given. However, you should know how to use each structure and which one is best for which situation.
18.8.1. Using VIEWs
Do not nest VIEWs too deeply; the overhead of building several levels eats up execution time, and the extra storage for materialized VIEWs can be expensive. Complex nesting is also hard to maintain. One way to figure out what VIEWs you should have is to inspect the existing queries for repeated subqueries or expressions. These are good candidates for ...
Get Joe Celko's SQL for Smarties, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.