Database – data aggregation in microseconds in KDB units

How to use the xbar function to aggregate the rows in a table in a 10-microsecond column. The table consists of the columns timestamp and val. For aggregation in milliseconds, I already know that I can Use timestamp.datetime in the xbar query.

The possible result table should be as follows:

timestamp | val
-- ------------------------| ---
2015.12.02D12:19:44.434430| 2
2015.12.02D12:19 :44.434440| 8
2015.12.02D12:19:44.434450| 5

Any help is appreciated.

The following should work:

d:([]t:asc .z.P+100*10?100;v :10?10)
select avg v by (10*1000) xbar t from d

Please note that the output time column is still “timestamp” (“p”) type, but these The value is forbidden in microseconds.

For clarity, I write the first xbar parameter as (10 * 1000). To change to 5 microseconds, you can do (​​5 * 1000) etc.

How to use the xbar function to aggregate the rows in the table in a 10-microsecond column. The table is composed of the columns timestamp and val. For processing in milliseconds Aggregation, I already know that I can use timestamp.datetime in the xbar query.

The possible result table should look like this:

timestamp | val
--------------------------| ---
2015.12.02D12:19:44.434430| 2< br />2015.12.02D12:19:44.434440| 8
2015.12.02D12:19:44.434450| 5

Like any help Reward.

The following should work:

d:([]t:asc. z.P+100*10?100;v:10?10)
select avg v by (10*1000) xbar t from d

Please note that the output time column is still “time Stamp” (“p”) type, but these values ​​are forbidden in microseconds.

For clarity, I will write the first xbar parameter as (10 * 1000). Change to 5 In microseconds, you can do (​​5 * 1000) and so on.

Leave a Comment

Your email address will not be published.