I'm trying to execute a long running query through the UI or the Ruby API on Google Cloud Spanner. The goal is to have all rows older than a certain timestamp expire, so the SQL is very simple, that's not the issue. I estimate the query would take at least an hour with the amount of rows I have.
In UI the page crashes after a minute and in Ruby API it raises an error
Google::Cloud::DeadlineExceededError
after 60 or 120 seconds depending on the gem version.
How can I execute the query to delete the old rows?
I would suggest looking at using Partitioned DML with the Client#execute_partition_update
method. The documentation states that this method is a "good fit for large, database-wide, operations that are idempotent, such as deleting old rows from a very large table".