Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KDB simple keyed table performance

Tags:

c#

q-lang

kdb+

I have the following table, about 3m rows. I want to know which approach/attributes I can use the squeeze maximum performance out of it. I will be selecting only on exact matches for inst + time.

price_hist_5min_bars:([inst:`$();time:`timestamp$()]price:`float$())

Also, does the approach change if the table is for reporting only or is changing? This table won't have any rows added to it on-the-fly but I will have another intra-day table with the same structure which will have rows added every 1 or 5 mins. All suggestions appreciated!

like image 429
Tokyo D Avatar asked Aug 04 '26 20:08

Tokyo D


1 Answers

If this is in memory i would imagine you want a sorted attribute on the time field and a group attribute on inst field.

If this is for a very specific use case where you only want to extract values of inst+time you could look into creating a composite key of inst and time. The look up of this will be a lot faster as means you could use the unique attribute on that key. However if you're receiving the data in real time you'll also have to account for the processing time to create such a composite key.

like image 149
emc211 Avatar answered Aug 06 '26 08:08

emc211



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!