Chris Taylor
Chris Taylor

Reputation: 47402

Size of a table (in bytes) in Q

How can I read the size of a table (in bytes) in Q?

I know that hcount returns the size of a file in bytes, but I can't find something similar for tables (or in general any object...)

Upvotes: 3

Views: 734

Answers (3)

Mark Kelly
Mark Kelly

Reputation: 1790

−22!x is an optimised shortcut to count -8!x

q)(-22!trade)~count -8!trade
1b
q)\t:100 count -8!trade
3596
q)\t:100 -22!trade
839

Upvotes: 2

bua
bua

Reputation: 4890

this is serialized (wire) object size
play around with \w this will give you object size in memory

q)a:til 10000
q)count -8!a
40014
q)\w
176464 67108864 67108864 0 0 2137387008j
q)b:til 10000
q)\w
242000 67108864 67108864 0 0 2137387008j
q)242000-176464
65536
q)\ts b,a
0 131200j
q)131248%2
65624f
q)

Upvotes: 1

Chris Taylor
Chris Taylor

Reputation: 47402

After some searching, it appears that count -8!tablename does the trick.

Upvotes: 0

Related Questions