Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Tune dates from DATE to INT type

$
0
0
I am having a hard time automating a DB2 SQL report without the execution time jumping from 1min to 30 min.

My table has a fields named date and dateint. dateint has an index and runs very fast when using it. however when I trying to automate it my query runs for over 30min. does anyone have any advice?

<this runs in 1 min>
select .... from ...
where dateint between 20121005 and 20121012

<this runs over 30 min>
select .... from ...
where dateint between int(current_date - 7 days) and int(current_date)

has anyone encountered this problem? how do I work around it?

Viewing all articles
Browse latest Browse all 13329

Trending Articles