How to delete multiple records in Aerospike given multiple keys through a single AQL query?

I have a list of Aerospike keys with me. I need to delete all the records associated with these keys using AQL.

I am aware of the delete query for a single key. Like this:

DELETE FROM <ns>[.<set>] WHERE PK=<key>

However, I would like to delete them all using AQL in a single query. Is there any such query to delete in bulk?

1 Answer

I don't think you can do that. How are these keys generated? If there is a pattern to it, then you can write a short python script to generate a text file, which has the delete commands. For example:

File: mydelete.txt
DELETE FROM ns1.set1 WHERE PK = 'k1'
DELETE FROM ns1.set1 WHERE PK = 'k2'
etc..

Then, in AQL, use the RUN command.

aql> RUN 'mydelete.txt'

However, if you want to delete all the records in a set, you can use TRUNCATE in AQL.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like