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
4
votes
1 answer

why is kdb process showing high memory usage on system?

I am running into serious memory issues with my kdb process. Here is the architecture in brief. The process runs in slave mode (4 slaves). It loads a ton of data from database into memory initially (total size of all variables loaded in memory…
4
votes
1 answer

How do a simultaneous ascending and descending sort in KDB/Q

In SQL, one can do SELECT from tbl ORDER BY col1, col2 DESC In KDB, one can do `col1 xasc select from tbl or `col2 xdesc select from tbl But how does one sort by col1 ascending then by col2 descending in KDB/Q?
gbronner
  • 1,907
  • 24
  • 39
4
votes
2 answers

KDB: select first n rows from each group

How can I extract the first n rows from each group? For example: for table bb: ([]sym:(4#`a),(5#`b);val: til 9) sym val ------------- a 0 a 1 a 2 a 3 b 4 b 5 b 6 b 7 b 8 How can I select…
ph0603
  • 41
  • 1
  • 3
4
votes
2 answers

KDB selecting first row from each group

Very silly question... Consider the table t1 below which is sorted by sym. t1:([]sym:(3#`A),(2#`B),(4#`C);val:10 40 12 50 58 75 22 103 108) sym val A 10 A 40 A 12 B 50 B 58 C 75 C 22 C 103 C 108 I want to select the first row…
bigO6377
  • 1,256
  • 3
  • 14
  • 28
4
votes
2 answers

KDB Excluding rows that have nulls

I have a table that has a handful of cells with null values (scattered across the dataset). Any simple way of exluding all rows that have a null in any of its columns? I'm just trying to avoid this... select from T where not null col1, not null…
bigO6377
  • 1,256
  • 3
  • 14
  • 28
4
votes
2 answers

Choose second largest or smallest number in KDB

Is there a simple way to find the second largest or smallest number in a group of columns of a table? I can easily find the largest or smallest by using select min/max (a, b, c, d) by i from t. However I can't seem to figure out a simple way to…
ks-man
  • 167
  • 2
  • 14
4
votes
1 answer

Changing the IPython interpreter

I'm using Python with kdb+. To do this I'm using PyQ, which brings Python and kdb+/Q to the same process and allows both languages to operate on the same set of data/memory space. After some effort, I am able to load Python into the kdb+/Q process…
Morten
  • 1,819
  • 5
  • 28
  • 37
4
votes
1 answer

How to send a data.frame from R to Q/KDB?

I have a large data.frame (15 columns and 100,000 rows) in an existing R session that I want to send to a Q/KDB instance. From KDB's cookbook, the possible solutions are: RServer for Q: use KDB to create new R instance which shares memory space.…
mchen
  • 9,808
  • 17
  • 72
  • 125
4
votes
2 answers

KDB: Select rows corresponding to two updated columns

Consider financial quote data in which the bid and ask don't always get updated simultaneously. I would like to select just the rows where both the bid and the ask reflect the new market levels. In the table below, this would correspond to…
bigO6377
  • 1,256
  • 3
  • 14
  • 28
4
votes
1 answer

Does the ticker plant pubsub work over websockets

I am trying to subscribe to realtime data from the ticker plan over a websocket. I am using .z.ws:{neg[.z.w] -8!value -9!x;} as the ws handler. I've tested the WebSocket mechanism connecting to rdb successfully. Eg. simple 10#trade returns trade…
David Hall
  • 341
  • 2
  • 8
4
votes
2 answers

How to stream data in KDB?

I have access to a realtime KDB server that has tables with new data arriving every millisecond. Currently, I'm just using a naive method which is basically like: .z.ts:{ newData: getNewData[]; / get data arriving in the last second …
mchen
  • 9,808
  • 17
  • 72
  • 125
4
votes
3 answers

Downloading FTP files in Q (KDB)

Does anybody know if there is any way to download files from ftp server directly from Q (kdb) ? I know that it's possible to use http but didn't see any examples of using ftp. Seems only way is to write wrapper around something like curl etc, but…
mde
  • 334
  • 4
  • 9
4
votes
4 answers

KDB: apply dyadic function across two lists

Consider a function F[x;y] that generates a table. I also have two lists; xList:[x1;x2;x3] and yList:[y1;y2;y3]. What is the best way to do a simple comma join of F[x1;y1],F[x1;y2],F[x1;y3],F[x2;y1],..., thereby producing one large table?
bigO6377
  • 1,256
  • 3
  • 14
  • 28
4
votes
2 answers

How to set maximum execution time for KDB query?

Especially when querying a remote KDB instance, having a typo in your query which causes it to take hours instead of seconds is a pain -- since the server is remote, I can't even access it to kill the KDB instance. So I have wondering if there is…
mchen
  • 9,808
  • 17
  • 72
  • 125
4
votes
1 answer

How to get data for a time range in Q/kdb?

I have the following function in q: { raze {[x] update PnlTime:x from flip ?[getPnl[`date`status!(2013.05.14;`traded)]; ();();`date`Id`market`pnl!(`date;`Id;`market;x)] } each `pnl_0s`pnl_1s`pnl_5s } Here, I…
anu
  • 295
  • 2
  • 7
  • 15