Reputation: 2242
I am using the aerospike list feature (http://www.aerospike.com/docs/guide/cdt-list.html) and can do a select query to see the list:
select bin from ns.set where PK='pk'
but is there a way I can get the number of elements in the list ? And also fi there is a way I can see the current size of the record (because there is a limit on the max record size)
Upvotes: 4
Views: 2356
Reputation: 7117
AQL is a tool mostly used for managing indexes, UDFs, running ad-hoc UDFs (maintenance, rollups, etc) and to a lesser extent for browsing your data. If you want to use the full set of List or Map operations, you should use a language client such as Java, Python, Go, etc.
The List API includes the size() of the list. For example, in the Python client you have aerospike.Client.list_size
. Because the list is stored in a msgpack serialized format at the server-side, it's going to be hard for you to tell if the msgpacked list is larger than your max-write-block
, assuming your data is on SSD (if it's in-memory without persistence you don't have the same record size limit).
You can estimate the size, but to follow the EAFP principle, it would be simpler to write the record without worrying about the size in advance, and catch the exception for error code 13 'record too big' (for example, aerospike.exception.RecordTooBig
). You can then decide on how to overflow into separate records (key
, key-2
.. key-N
).
Upvotes: 4