Composite keys for Aerospike

Trust what Vikrant is looking for is if you have records such as: Last Name | State | Shoe Size as the 3 bins in the data, and record’s primary key is say some “userid”, Vikrant wants to query a specific lastname+state combination i.e. fetch all Gupta in CA. Building such composite keys out of data in bins is not possible in Aerospike. While the query is possible using Secondary Indexes and Predicate Filtering - this concept of “Composite Key” is not available - no APIs hence. What Albot is suggesting is using the primary key as: “Gupta:CA:userid” to store the record instead of “userid” and then use logic in application to batch read the records that are of interest. In this case, somewhere you will keep a count of total userids for “Gupta:CA” so you can build the list of keys to retrieve via batch read. i.e. [Gupta:CA:0, Gupta:CA:1, … Gupta:CA:xxx (last)]

1 Like