Questions tagged [kdb]

kdb+ is a proprietary high-performance database developed by Kx Systems.

kdb+ is a proprietary high-performance database developed by KX.

Features

  • Scalable column-oriented database for massive data volumes
  • Manages real-time and historical data in one platform
  • A single system allowing for low latency communication between kdb+ processes
  • Coupled with the expressive q programming and query language

It comes with a programming language called q (or kdb/q). Both q and kdb are written in the k language which has the tag on this site.

More Information

KX have recently launched the KX Community, a site moderated daily by KX employees to ensure all questions are answered. For any questions, on q/kdb+ or any of the KX technology and products, our KX experts are on hand to help!

2014 questions
5
votes
2 answers

Grouping data in kdb with certain condition

I have a main dataframe named raw which looks like this: tab:([]date:2018.02.05 2018.02.05 2018.02.06 2018.02.06;time:01:30:25.000 02:30:45.000 04:15:15.000 02:15:15.000;vol:50 55 64 12; name:`A`B`B`A) date time vol name …
user8415577
5
votes
4 answers

kdb q - lookup in nested list

Is there a neat way of looking up the key of a dictionary by an atom value if that atom is inside a value list ? Assumption: The value lists of the dictionary have each unique elements Example: d:`tech`fin!(`aapl`msft;`gs`jpm) / would like to get…
tenticon
  • 2,639
  • 4
  • 32
  • 76
5
votes
1 answer

KDB reverse asof join (aj) ie on next quote instead of previous one

aj[`time`sym;trade;quote] is joining each trade with the previous value of quote. I'd like to do the same join, but on the next value of quote instead of the previous one. How can I achieve this?
Sithered
  • 481
  • 7
  • 23
5
votes
1 answer

Segmentation Fault - pthread mutex locking issue

I am creating a simple kdb+ shared library which generates values on a seperate thread and executes a callback function when data is ready. The application is writing data to a file descriptor in the new thread and reading from this in the main…
5
votes
3 answers

How to query KDB table where one column is a list?

I have a table in KDB where one of the columns is a list of symbols, for example:- q)table:([id:1 2 3 4 5] books:((`book1`book2);(enlist `book6);(enlist`book3);(enlist`book4);(`book2;`book5))) q)table id| books --| ------------ 1 | `book1`book2 2 |…
Alan Chan
  • 257
  • 2
  • 11
5
votes
1 answer

Aggregation of data in microsecond bars in kdb+

How can I use the xbar function to aggregate rows in a table in 10 microsecond bars. The table consists of the columns timestamp and val. For aggregating in millisecond bars instead I already know that I can simply use timestamp.datetime in the xbar…
user1056903
  • 921
  • 9
  • 26
5
votes
2 answers

kdb+: replace null integer with 0

Consider the following table: myTable: a b ------- 1 2 3 10 4 50 5 30 How do I replace the empty cells of b with a zero? So the result would be: a b ------- 1 0 2 0 3 10 4 50 5 30 Right now I'm…
Jean-Paul
  • 19,910
  • 9
  • 62
  • 88
5
votes
2 answers

kdb+: use string as variable name

How can I use a string as a variable name? I want my variable name to be constructed during runtime, but how can I use it as a left argument and assign a value to it? Example: [`$"test"] : 1 / 'assign error
Jean-Paul
  • 19,910
  • 9
  • 62
  • 88
5
votes
1 answer

How to get the total size of a table in kdb+?

I'm trying to find the memory usage of an in-memory table in q. How can I display this? It is receiving live updates and I would like to keep track of the total used memory of such a table. I can't seem to find any relevant functions/commands for…
Jean-Paul
  • 19,910
  • 9
  • 62
  • 88
5
votes
4 answers

KDB Query for OR operator

What is the equivalent query in KDB Web: SELECT * FROM TABLE WHERE (COLA = 'A' AND COLB = 'B') OR (COLA = 'C' AND COLB = 'D') http://kdbserver:5001/?select fro table where _____________________ N.B.: cola and colb are having string datatype
Debananda
  • 476
  • 1
  • 6
  • 17
5
votes
1 answer

Unix Timestamp in kdb/q

Is there a built-in way of getting the Unix timestamp in kdb/q? Something like `float$.z.p would be ideal; otherwise I'll have to resort to a more laborious implementation where I count the seconds from Jan 1 1970.
nightTrevors
  • 639
  • 4
  • 11
  • 24
5
votes
1 answer

ADO with KDB+/qodbc.dll in VBA

I have an Excel based application reliant on several different databases which I connect to using ADO (Microsoft ActiveX Data Objects 6.1 Library). The databases reside on regional servers and there is an overhead in establishing the initial…
user2579685
  • 319
  • 9
  • 19
5
votes
1 answer

How to use .year inside function in KDB?

I would like to use dot notation to extract the year of a date. q) myDate:2014.01.01; q) myDate.year 2014i / works OK But when inside a function, f:{[x] :x.year}; f[myDate] I get an error (I use Studio for KDB+) An error occurred during…
mchen
  • 9,808
  • 17
  • 72
  • 125
5
votes
2 answers

How to remove consecutive duplicate rows in KDB?

For instance, if I have the below table, then I want to remove the 3rd row: Stock Price ------------------- GOOG 101 GOOG 102 GOOG 102 <- want to remove this GOOG 101 Note: even though row 4 is a duplicate of row 1, I don't want…
mchen
  • 9,808
  • 17
  • 72
  • 125
5
votes
3 answers

What performance can we expect from kdb+ 32bit

Kx announced their free kdb+ (32bit) time series database. What performance in terms of reads/writes per second can we typically expect from this database? I do understand this is a complex question as the answer depends on a setup, number of nodes,…
Datageek
  • 25,977
  • 6
  • 66
  • 70