|
We use and recommend |
Thinking In SetsWhen writing SQL queries always remember – “Think in sets”! Remember that your RDBMS is actually a set processor, so let it do it’s work and avoid ‘procedural’ queries! For example, when writing queries to derive interrow values it appears “obvious” that you must use sub-queries (ignoring the possibility that your RDBMS product provides the MODEL operator). However, you will quickly find that the execution time goes up rapidly as the number of rows in your database increases! For example, the following execution times were noted for a sub-query method on a table with 18 columns, properly indexed, using MySQL 5.0:
The query was rewritten to obtain the same result by creating then joining two temporary tables (ie, without sub-queries), with the following results:
|
All original content © 2007 My-OLAP.net webmaster@My-OLAP.net