Partition Primary Index – Basics

Partitioned primary index or PPI is used for physically splitting the table into a series of subtables. With the proper use of Partition primary Index we can save queries from time consuming full table scan. Instead of scanning full table, only one particular partition is accessed.


Follow the example below to get the insight of PPI –

We have an order table (ORDER_TABLE) having two columns – Order_Date and Order_Number, in which PI is defined on Order_Date. The primary Index (Order_Date) was hashed and rows were distributed to the proper AMP based on Row Hash Value then sorted by the Row ID. The distribution of rows will take place as explained in the image below –

PPI_1

Now when we execute Query –

Select * from Order_Table where Order_Date between 1-1-2003 and 1-31-2003;

This query will result in a full table scan despite of Order_Date being PI.

PPI_2

Now we have defined PPI on the column Order_date. The primary Index (Order_Date) was hashed and rows were distributed to the proper AMP based on Row Hash Value then sorted by the Order_Date and not by Row ID. The distribution of rows will take place as explained in the image below –

PPI_3

Now when we execute Query –

Select * from Order_Table where Order_Date between 1-1-2003 and 1-31-2003;

This query will not result in a full table scan because all the January orders are kept together in their partition. 

PPI_4



Partitions are usually defined based on Range or Case as follows.

Partition by CASE

CREATE      TABLE ORDER_Table (

ORDER_ID  integer NOT NULL,

CUST_ID integer NOT NULL,

ORDER_DATE  date ,

ORDER_AMOUNT integer

)

PRIMARY INDEX (CUST_ID)

PARTITION BY case_n ( 

ORDER_AMOUNT  < 10000 ,

ORDER_AMOUNT  < 20000 ,

ORDER_AMOUNT  < 30000,

NO           CASE     OR        UNKNOWN ) ;


Partition by RANGE

CREATE      TABLE ORDER_Table

(

ORDER_ID  integer NOT NULL,

CUST_ID integer NOT NULL,

ORDER_DATE  date ,

ORDER_AMOUNT integer

)

PRIMARY INDEX (CUST_ID)

PARTITION BY range_n (

ORDER_DATE BETWEEN date ‘2012-01-01’ and ‘2012-12-31’ Each interval ‘1’ Month,

NO        range OR  UNKNOWN ) ;

If we use NO RANGE or NO CASE – then all values not in this range will be in a single partition.

If we specify UNKNOWN, then all null values will be placed in this partition


To know about the advantage and disadvantage of PPI please go to link below –

Partition Primary Index – Advantage and Disadvantage

85 comments

Skip to comment form

  1. I’ll right away grab your rss feed as I can’t find your e-mail subscription hyperlink or newsletter service. Do you’ve any? Kindly let me know so that I may subscribe. Thanks.

  2. Thank you for the good writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! However, how could we communicate?

  3. Hi, I log on to your new stuff daily. Your story-telling style is witty, keep doing what you’re doing!

  4. I simply could not leave your website prior to suggesting that I actually enjoyed the standard information an individual supply in your visitors? Is gonna be again incessantly in order to check out new posts

  5. I’ll right away snatch your rss as I can’t in finding your email subscription hyperlink or newsletter service. Do you’ve any? Please permit me understand so that I may subscribe. Thanks.

  6. Hello! I’ve been reading your site for some time now and finally got the courage to go ahead and give you a shout out from Dallas Tx! Just wanted to mention keep up the fantastic work!

  7. I will immediately seize your rss as I can’t in finding your email subscription link or e-newsletter service. Do you’ve any? Kindly let me know so that I may just subscribe. Thanks.

  8. I visited multiple sites except the audio feature for audio songs existing at this website is truly marvelous.

  9. Ahaa, its good conversation regarding this post here at this webpage, I have read all that, so now me also commenting here.

  10. I’ll immediately seize your rss as I can not to find your e-mail subscription hyperlink or newsletter service. Do you have any? Please permit me recognise in order that I may subscribe. Thanks.

    • Kirsten4474 on January 14, 2026 at 12:54 pm
    • Reply

    https://shorturl.fm/4lnX3

  11. I simply could not leave your site prior to suggesting that I extremely enjoyed the usual information a person provide on your guests? Is going to be again incessantly to investigate cross-check new posts

    • Maxwell3995 on January 12, 2026 at 7:10 am
    • Reply

    https://shorturl.fm/4DwiM

  12. I am sure this article has touched all the internet users, its really really pleasant paragraph on building up new website.

    • Maliyah1010 on January 9, 2026 at 11:44 am
    • Reply

    https://shorturl.fm/gaUcW

  13. This excellent website really has all of the information and facts I needed concerning this subject and didn’t know who to ask.

  14. Tigrinhobet, meu camarada! Achei um site show de bola pra dar uns palpites. Fácil de usar e as odds são daquelas que enchem o bolso! Vale a pena conferir tigrinhobet.

    • Herbert2761 on December 28, 2025 at 8:14 pm
    • Reply

    https://shorturl.fm/B7KNg

    • McKenzie227 on December 28, 2025 at 3:00 pm
    • Reply

    https://shorturl.fm/eO1Zo

    • McKenzie3520 on December 25, 2025 at 10:38 pm
    • Reply

    https://shorturl.fm/jii9G

  15. Interesting read! Understanding player behavior & RTP (like with nustargame link) is key to solid poker strategy. Variance is real, but informed decisions matter most. Good analysis!

    • Henry472 on December 20, 2025 at 6:07 pm
    • Reply

    https://shorturl.fm/4baQ4

    • Amber4222 on December 18, 2025 at 5:50 am
    • Reply

    https://shorturl.fm/cU5kx

  16. Been playing at ph123casino for a bit now. Site’s pretty smooth, and I’ve actually had some decent luck. Check it out ph123casino. You might get lucky too!

  17. Great resource for finding AI tools! As someone always on the hunt for efficiency, platforms like AI Consulting Assistant save time and streamline decision-making.

    • Tristan3446 on December 6, 2025 at 1:49 am
    • Reply

    https://shorturl.fm/TXZxI

  18. Just saw phplus pop up, anyone know anything about it? Is it worth a visit? I’m always on the lookout for a new place to play. Let me know your thoughts! Here’s the link: phplus

    • Nathaniel1148 on December 2, 2025 at 5:04 pm
    • Reply

    https://shorturl.fm/o2JoB

    • Clifford2323 on November 30, 2025 at 11:07 am
    • Reply

    https://shorturl.fm/GWosv

    • Mason586 on November 26, 2025 at 8:12 pm
    • Reply

    https://shorturl.fm/03tQp

    • Carl3819 on November 23, 2025 at 10:58 pm
    • Reply

    https://shorturl.fm/OaBbe

    • Drake2969 on November 23, 2025 at 9:23 am
    • Reply

    https://shorturl.fm/hHUE4

    • Stephanie4156 on November 23, 2025 at 4:59 am
    • Reply

    https://shorturl.fm/p68Gh

    • Jaden2781 on November 22, 2025 at 2:50 am
    • Reply

    https://shorturl.fm/TLh2O

    • Carter2877 on November 18, 2025 at 11:10 am
    • Reply

    https://shorturl.fm/jQP61

    • Harry472 on November 15, 2025 at 2:58 am
    • Reply

    https://shorturl.fm/vusXp

    • Breanna3697 on November 14, 2025 at 9:01 am
    • Reply

    https://shorturl.fm/Jz8Ts

    • Payton4254 on November 13, 2025 at 8:17 pm
    • Reply

    https://shorturl.fm/JXAph

    • Hermione1172 on November 13, 2025 at 8:17 pm
    • Reply

    https://shorturl.fm/C3Rwq

    • Moses4827 on November 12, 2025 at 6:14 pm
    • Reply

    https://shorturl.fm/4ZlWf

    • June4424 on November 10, 2025 at 7:24 am
    • Reply

    https://shorturl.fm/V7NBN

    • Willow3181 on November 9, 2025 at 5:24 pm
    • Reply

    https://shorturl.fm/Qw074

    • Brian4053 on November 7, 2025 at 8:45 am
    • Reply

    https://shorturl.fm/93SK5

    • Sadie3145 on November 6, 2025 at 8:56 pm
    • Reply

    https://shorturl.fm/prXhF

    • Arthur4197 on November 6, 2025 at 8:26 am
    • Reply

    https://shorturl.fm/DgwgK

    • Jace4545 on November 5, 2025 at 11:19 am
    • Reply

    https://shorturl.fm/VvYSA

    • Joel3453 on November 2, 2025 at 10:51 am
    • Reply

    https://shorturl.fm/6hQjz

    • Davis2758 on November 2, 2025 at 7:11 am
    • Reply

    https://shorturl.fm/vOEnp

    • Harley1109 on November 1, 2025 at 5:03 am
    • Reply

    https://shorturl.fm/B5954

    • Victor658 on October 28, 2025 at 5:50 am
    • Reply

    https://shorturl.fm/pov54

    • Sagar on March 23, 2017 at 8:02 am
    • Reply

    Hi,

    The explanatin is good but need to understand how the data is been retrieved while quering on PPI?
    Will it exactly query only that partition in AMP instead of having so many number of partitins in AMP?

    1. Data retrieval process remains same with the exception of an additional check on partition number. If you are using PPI column in where clause then with the help of binary search Teradata will query exact partition, but in case no PPI column is being used in where clause then it needs to scan all the rows (in respective AMP) to find the matching row. This is trade off of using PPI because all queries without PPI column face all rows scan (in single AMP).

      Hope it helps !!!

        • Sagar on June 13, 2017 at 8:02 am
        • Reply

        Thanks..one more question what happens if i define PPI columns other than PI column in that table.How the data is being retrieved.will the performamce increase or decrease by the above method.??

    • Vijay Jadoun on August 21, 2016 at 5:11 pm
    • Reply

    Dear admin ,

    thanks for share Wonderfull blog

    Thanks regards
    Vijay Jadoun

    • Veeresh alkod on May 23, 2015 at 7:32 am
    • Reply

    Thank you Sir.

    • Rajesh Korlepara on March 2, 2015 at 5:34 am
    • Reply

    What is the process to change the existing table to PPI table and will there be any change in row distribution after conversion into Partioned primary index?

    • krishnendu hazra on January 26, 2015 at 5:55 pm
    • Reply

    Sir can you please kindly explain multiload , the way u have explained fastload?

    fastload explanation was really helpful..

    Regards

    • viraj raina on January 9, 2015 at 9:18 am
    • Reply

    How many amp operation is PPI?

    1. can be any number of AMP depending on your query. but not full table scan if you are using PPI columns in where clause

    • Akanksha Gupta on November 12, 2014 at 9:16 am
    • Reply

    Range bases query on NUSI column ALWAYS do Full Table Scan OR it may utilize index?

    • Manoj on October 9, 2014 at 6:26 am
    • Reply

    simply superb explanation.

    • jeffry on August 28, 2014 at 11:19 am
    • Reply

    Information is very clear and simple…good work admin/..all the best for your future works

    • raj on August 7, 2014 at 1:44 pm
    • Reply

    will there be an impact while loading huge data into tables like performance increase/decrease

      • admin on September 26, 2014 at 12:44 pm
        Author
      • Reply

      yes definitely.
      if data is huge and your table is defined as SET table, then teradata needs to check uniqueness of each new row inserted. Similar check is required for Unique columns, UPI and USI as well.
      This is just one example where your performance can be degraded because of huge number of rows.

  19. its useful to me

    • anji on July 15, 2014 at 12:04 pm
    • Reply

    gud

    • Naveen on June 20, 2014 at 11:14 am
    • Reply

    Why it is called partition primary index ? if we can do PPI on any column no matter its PI or not .

    • dilip on April 30, 2014 at 12:15 pm
    • Reply

    I did not get this. So taking your last example. suppose cust_id is the primary index (NUPI) and you did the partitioning based on case (order_amount). Now i fire query like this:
    sel * from order table where order_amount between 5000 and 15000;

    what does it mean ? we are not quering on the PI (cust_id) at all ! this will result into FTS still..right.
    Also, why is it called PPI if the PI is cust_id and partitioning is done on ‘order_amount’ ? Thanks 🙂

    1. if order amount is defined as PPI, then optimizer will go for dynamic partition elimination step and pick only those partition which falls into the range specified in WHERE clause. Thus it will not be a FTS operation.

    • Sindhu on April 14, 2014 at 10:48 am
    • Reply

    Hi,
    Very nice explanation. Finally understood PPI.

    Thanks a lot!

    • CinderElla on March 11, 2014 at 4:29 pm
    • Reply

    How do I actually view infromation about the partitions? Info like amount of data in each partition, # of rows, date loaded, those kind of items?

    1. you can write SQL queries to achieve this result. I don’t think there is any teradata tool available for this.

    • Agilan on February 14, 2014 at 9:44 am
    • Reply

    Hi Admin,

    if we didnt mention NO RANGE OR NO CASE or UNKNOWN, what will happen to the records not falling in the range/case?

    Thanks.

  20. Hi,

    The article is really good.. 🙂
    One concern,
    In the example,since jan data is avilable in both the amp’s it would still require a full table scan right?

    1. No, because each AMP processes only his own part of the table, especially only his part of the partition of the table..

    • Muniraj on October 8, 2013 at 8:53 am
    • Reply

    Good explanation

    • Prasanna on July 15, 2013 at 1:33 pm
    • Reply

    Really superb. Very Simple explanation

    Finally i undeerstood PPI.

    Thanks Admin.

    • Nagesh on July 9, 2013 at 9:16 am
    • Reply

    Good One.

    • manju on June 3, 2013 at 2:53 pm
    • Reply

    good explaination.. could have explained about Each interval ‘1’ Month,

    • Sarika on April 10, 2013 at 1:28 pm
    • Reply

    I never understood PPI but after reading ur article my doubt is clear.

    • veera on March 24, 2013 at 8:35 am
    • Reply

    I missed ur website all these days 🙁 .. Really helpful …keep posting .

    1. Hi Veera,

      What do you mean by missed it ? … are you facing some server downtime for my website ?
      Next time please let me know in case you are facing this issue on my site 🙂

  21. Very Well explained 🙂
    Thanks for sharing this info.

    1. Thanks 🙂

        • Naveen on May 6, 2014 at 11:17 am
        • Reply

        well explained..

        why it is called parition primary index ?
        if we can do PPI on any column no matters its PI or not .

Leave a Reply to Brian4053 Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.