Search code examples
db2database-partitioning

DB2 Partitioning


I know how partitioning in DB2 works but I am unaware about where this partition values exactly get stored. After writing a create partition query, for example:

CREATE TABLE orders(id INT, shipdate DATE, …)
  PARTITION BY RANGE(shipdate)
    (
    STARTING '1/1/2006' ENDING '12/31/2006' 
     EVERY 3 MONTHS
    )  

after running the above query we know that partitions are created on order for every 3 month but when we run a select query the query engine refers this partitions. I am curious to know where this actually get stored, whether in the same table or DB2 has a different table where partition value for every table get stored.

Thanks,


Solution

  • After a bit of research I finally figure it out and want to share this information with others, I hope it may come useful to others.

    How to see this key values ? => For LUW (Linux/Unix/Windows) you can see the keys in the Table Object Editor or the Object Viewer Script tab. For z/OS there is an Object Viewer tab called "Limit Keys". I've opened issue TDB-885 to create an Object Viewer tab for LUW tables.

    A simple query to check this values:

    SELECT * FROM SYSCAT.DATAPARTITIONS

    WHERE TABSCHEMA = ? AND TABNAME = ?

    ORDER BY SEQNO

    reference: http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.5.0/com.ibm.db2.luw.sql.ref.doc/doc/r0021353.html?lang=en