Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AQL - How to show PK in a SELECT

Tags:

aerospike

How do I include the PK when doing a AQL select?

Example:

SELECT * from test.users

Returns:

FirstName, LastName etc

What I really want to know is the PK or key so I can delete a row. How can I include the PK in a SELECT AQL statement.

like image 965
Simon C Avatar asked Dec 26 '22 07:12

Simon C


1 Answers

By default, Aerospike does not store the actual primary key in the database. It stores the 20-byte digest (hash of the key) by default. This will be a huge saving for the large keys. However, in the latest version, this can be changed by the put() operation to store the key also. But the AQL client is not enhanced yet to exploit this fact. I will file an internal ticket for this enhancement.

In the mean time...

  1. option-1 : you can take a backup of your data which will also dump the digests (hash of key) in base64 encoding format. You can use those digests to delete the records.
  2. option-2 : if you write scan code using C/Java or any API, you will get the list of digests too. You can use them to delete the records.
like image 121
sunil Avatar answered Jan 28 '23 12:01

sunil