Robert Kubrick
Robert Kubrick

Reputation: 8713

How to display KDB row size?

count returns the number of elements of a list, or table rows, or the length of a string. Is there a way to print the size of the row itself? In other words, I want to know the size of a table I loaded in memory, not simply the number of rows.

And what about the total size of a list of strings? Do I have to use each to calculate the sum of all string lengths or there is another way?

Upvotes: 4

Views: 3022

Answers (1)

user1895961
user1895961

Reputation: 1186

Depending on which version you're using. You can use

q)-22!x / 2.7 or later I believe

or

q)count -8!x

So

q)tbl:([]ids:10?`1;price:10?100.0)
q)count -8!tbl
145
q)count -8!("one";"two";"three")
43
q)count -8!("one";"two";"three";"4")
45

See http://code.kx.com/q/ref/internal/

Upvotes: 4

Related Questions