Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Table Partition - response (60) by ToddAWalter

$
0
0

When the partitioning expression is very complicated, the optimizer cannot see through it to see that the partition access can be done. This is especially true for multiple casts.
If you change the partitioning expression to:
CREATE SET TABLE PLS.tableb ,NO FALLBACK ,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL,
     CHECKSUM = DEFAULT,
     DEFAULT MERGEBLOCKRATIO
     (
      PLCY_NBR INTEGER,
      MO_ID INTEGER,
      PLCY_STATUS VARCHAR(20) CHARACTER SET LATIN NOT CASESPECIFIC)
PRIMARY INDEX ( PLCY_NBR ,MO_ID )
PARTITION BY RANGE_N(CAST((((MO_ID - 190000 )* 10 )+ 1 ) AS DATE) BETWEEN
DATE '2010-01-01' AND DATE '2090-12-01' EACH INTERVAL '1' MONTH );
Then you can get partition access for single equality. It does not appear that it will work for an IN list though, you can union multiple selects together for that.
Have you considered doing the type conversion during ETL and storing it as a date rather than as a monthid? Then everything works cleanly.


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>