Difference between the partition by syntax

Database
Enthusiast

Difference between the partition by syntax

Hi,

Please help me to understand what is the Difference between below query performance wise and which one will work faster

 PARTITION BY RANGE_N(YYMM_NUM  BETWEEN 201301  AND 201312  EACH 1,

        201401 AND 201412 EACH 1,

        201501 AND 201512 EACH 1,

        201601 AND 201612 EACH 1,

        201701 AND 201712 EACH 1,

        201801 AND 201812 EACH 1,

        201901 AND 201912 EACH 1,

        202001 AND 202012 EACH 1




 

OR

PARTITION BY RANGE_N(SNAP_YYMM_NUM  BETWEEN 201205  AND 202012  EACH 1 );



3 REPLIES
Enthusiast

Re: Difference between the partition by syntax

Please reply

Junior Contributor

Re: Difference between the partition by syntax

There should be no performance difference when partition stats are current.

But #1 is recommended because it's defining only the actual possible year/month values while #2 also defines partitions for non-existing months like outside of 1 to 12.

Dieter

Enthusiast

Re: Difference between the partition by syntax

Thanks Dieter!!