Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does q cache data?

Tags:

kdb

I was trying to measure data access times for a db I had created. It was taking ~1s for one day's data. To aggregate I ran the following code. I am using kdb studio and there are ~1MM trades in total every day

\t ans: raze {select from trade where date=x, sym=`ABC} each 20#dtl

dtl was the entire list of dates. I closed the server and ran it again and surprisingly this took <1 second. As this was contrary to what I had observed above, I ran this

\t ans: raze {select from trade where date=x, sym=`ABC} each 20#20_dtl

and now it took ~21 seconds. My question is if i close the kdb server, is it possible for q to still cache some of the previous results?

like image 228
Naveen Sharma Avatar asked Oct 21 '22 23:10

Naveen Sharma


1 Answers

This is likely due to your operating system caching the data it reads from disk. Kdb+ provides no inbuilt caching by default.

like image 155
MdSalih Avatar answered Oct 25 '22 18:10

MdSalih