var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: DB2 where 1=1
I build up my query in my program. To prevent some programming errors, I start the where condition in my query always with a "where 1=1" statement.
- Does it effect the performance of my queries or is db so clever that it recognizes it.
If you are using 'where 1=1' on large-tables in a production environment *and* you have no other predicates in the WHERE clause* then it is the same as having no where clause at all.
With the sole predicate being 1=1, you will fetch too many rows. This can stress your database and your network if the result-sets are large and/or if the row-counts in the target-tables are high.
If you are working on a personal development environment then it does not matter.
But if you are working on any mult-user environment with many other people sharing those resources then you really should not do this, particularly on a production environment.
Visit the new-look IDUG Website
, register to gain access to the excellent content.
Tags for this Thread