IN query on PK

query
udf

#1

How to perform IN queries in aerospike. Do we need an UDF for this? Something like this: Select * from ns.set where PK in (1,2,3)


#2

In Ver 3.12.1+, you can run such queries if you store your Primary Key in a bin and then run predicate filtering on that bin. See http://www.aerospike.com/docs/guide/predicate.html

Aerospike by default does not store the PK in its raw string or numeric form as you assign it. It stores a RIPEMD160 hash of the PK+Set name.


#3

In AQL, you cannot perform this kind query. But in aerospike client, for example python, you can use, “get_many” api to get multiple keys. https://pythonhosted.org/aerospike/client.html#aerospike.Client.get_many In java api, you also can use batch policy to do that such as Record[] get(BatchPolicy policy, Key[] keys, String... binNames) if you want to store PK in aerospike, you need to set write policy when data insert. in java, it is “sendkey” field


#4

good point, the actual question though presented as a where query on PK really boils down to batch read! I missed that.