Search code examples
kdb

Difference between segmentation and partition in KDB


What is the difference between HDB segmentation and HDB partition? As per my understanding both stores the data in different partitions (based on date, month, year etc)


Solution

  • In Segmented table none of the partitions are under the same root; instead the root contains a file called par.txt having paths to different segments. while in partitioned table, all the partitions are under the same root.

    check out this link : https://code.kx.com/wiki/JB:KdbplusForMortals/kdbplus_database

    Use .Q.par to find the exact path(segment) of the a segmented table.

    The main advantage the segmented DB provides is the speed while doing the map reduce operations.

    Typical structure of partitioned db :

    /db
        [sym]
        /partition1
        /partition2
    

    Typical structure of segmented db :

    /db
        [sym]
        par.txt
        "
    ==drive1====
    /segment1
        /partition1
        /partition2
        "
    ==drive2====
    /segment2
        /partition1
        /partition2
        "