KDB - Historical Table - what's the “right” way to doing it?

Clash Royale CLAN TAG#URR8PPPKDB - Historical Table - what's the “right” way to doing it?
I have a point of sale system that exports my data to a .csv which I then import into KDB. Currently what I do is export all the data from the POS to the csv and then create a single table. I have about 10 months of sales data and my csv file is about 11mb. As time grows I imagine that the csv file will be really huge and I wonder if this is inefficient.
At my old job what we would do is have a table for each individual day of data and then there would be an _hist table which would combine all the daily files. So if I wanted to just look at the data for the day I would look at the invoicedata table and if I wanted to look across all time I would look at the invoidata_hist table and set the query to look at date within (dateA;dateB). I'm wondering if I should set things up this way rather than the way I'm doing it now.
Am I better off having one very large csv file with all the data in it or should I create a csv file for each individual day? If the second way is better can anybody give me an idea of the best way to set this all up?
Thanks!
1 Answer
1
If your total number of records are not going to exceed million then splaying/partitioning might be an overkill.
Having said that there are multiple ways you can store the data on disk apart from storing data as CSV, check out this link
Since you asked for a date partitioned in the question, actually there are different ways you can partition your data :
You might want to store the data in a monthly partition based on the table count.
For saving the data to a partition, you can use .Q.dpft function
.Q.dpft[directory;partition;`p#field;tablename]
example for code.kx:
q)trade:(sym:10?`a`b`c;time:.z.T+10*til 10;price:50f+10?50f;size:100*1+10?10)
q).Q.dpft[`:db;2007.07.23;`sym;`trade]
`trade
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.