KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ What is the role played by key columns in a keyed table [ query join/performance ] ? Re: What is the role played by key columns in a keyed table [ query join/performance ] ?

  • rocuinneagain

    Member
    May 24, 2022 at 12:00 am

    You can see the speed improvement if you index rather than query using qsql:

    q)select from t1 where Name=`Anand 
    Name Age Salary 
    ---------------- 
    Anand 10 1000 
    
    q)select from t2 where Name=`Anand 
    Name | Age Salary 
    -----| ---------- 
    Anand| 10 1000 
    
    q)t2`Anand 
    Age   | 10 
    Salary| 1000 
    
    q)\ts do[100000;select from t1 where Name=`Anand] 
    164 1808 
    
    q)\ts do[100000;select from t2 where Name=`Anand] 
    174 1808 
    
    q)\ts do[100000;t2`Anand] 
    71 960