SELECT LASTNAME, FIRSTNAME, ADDR1 FROM EMP SELECT LASTNAME, FIRSTNAME, ADDR1 FROM EMP WHERE 1 = 1Is there any difference in the treatment of the optimizer for the above two queries?
I've never seen an approach like this before. Perhaps you are confusing this with the approach of appending OR...
0 = 1 to a predicate to force DB2's hand when selecting an index at bind time. For example, consider this statement:
SELECT a,b,c FROM table1 WHERE d between 'A' and 'F' AND e > 1500;If there were two indexes, one on column d and one on column e, you could add OR 0 = 1 to one of the predicates to get DB2 to choose the index for the other. For example:
SELECT a,b,c FROM table1 WHERE d between 'A' and 'F' AND (e > 1500 OR 0 = 1);This would eliminate the index on e, and DB2 would choose the index on d. But this will not help in your situation because there are no other predicates.
Dig Deeper on IBM DB2 management
Related Q&A from Craig S. Mullins
Our expert suggests that the best way to pass the SAP BW exam is to have hands-on job experience. But that's not all he has to say about ...continue reading
To export data from a DB2 table to a flat file, you need to run an export specifying the proper file format. The export utility exports data from a ...continue reading
Craig Mullins recommends two specific resources for learning how to create and support Binary Large Objects (BLOB) in DB2.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.