Gorrace
Gorrace

Reputation: 1

Teradata table partition

I have partitioned a table thus:

partition by    ( range_N ( Prcsd_Dt between date '2015-07-01' and date '2027-06-30' each interval '1' year
                        , no range )
            , CASE_N    ( Prcsd_Cd =  1 ,
                      Prcsd_Cd =  2 ,
                      NO CASE OR UNKNOWN )
            )

If I do an EXPLAIN on this:

sel * from eptadhocedw.Fact_Usg_Log_Msg_smpl_Dt_msg_cd_P_TMP 
where Prcsd_Dt between date '2016-09-23' and '2016-09-25'
and Prcsd_Cd = 1

It says it needs to go to 2 partitions. I would have thought it would be just the one, as the date range is within one YEAR interval, i.e. - it goes to the partition that has prcsd_cd = 1 and the interval YEAR for prcsd_dt. And if I do cross over an INTERVAL year (eg - prcsd_dt between date '2017-06-25' and date '2017-07-05', it tells me it scans three partitions. There always seems to be the one extra. Does anyone know why?

Upvotes: 0

Views: 21

Answers (0)

Related Questions