Quote:
|
Originally Posted by citi
Shown below is a portion of a query that I've written. Would using date conditions cause DB2 to skip an index that is comprised of the
W02_POS_BEG_xx date fields? The table is fairly large. Despite a number of indexes, DB2 chooses to perform a tablescan instead of using the indexes.
|
I guess this would have been better stated as:
Quote:
|
Our data model is seriously flawed. We store dates as numeric fields for year, month, and day values, while many queries have values of the DATE datatype in their selection criteria. Performance is unacceptable. How can we improve it?
|
You have three options:
- change the way you store dates;
- create (and keep updated) a computed DATE column, calculated from your year, month, and day values; build an index on that column;
- parse the search criteria into the year, month, and day values and make your queries search by those values.