Db2 (On Premises and Cloud)

fullscan when not using hardcoded date on BLU database

  • 1.  fullscan when not using hardcoded date on BLU database

    Posted 30 days ago

    Hi,

    his is my issue:

     

    TIR001.VITU is a column organised table with about 9 billion rows.

     D_E_DEM_DEM has a date type

     

    select count(*) from TIR001.VITU where TIR001.VITU.D_E_DEM_DEM= '2016-09-17'  is very fast, less then 5s

    but

    select count(*) from TIR001.VITU where TIR001.VITU.D_E_DEM_DEM=TRUNCATE((DATE('2016-09-19') - (DAYOFWEEK(DATE('2016-09-19'))) DAYS ))  

    take 7 minutes (it make a full tablescan) 

     

    ps: TRUNCATE((DATE('2016-09-19') - (DAYOFWEEK(DATE('2016-09-19'))) DAYS ))   == '2016-09-17' == last saturday

     

    any idea about this issue ?