- Newest
- Most votes
- Most comments
CREATE TABLE foo (LIKE bar);
As an aside, you know when you use CTL, the new table loses the PK and FK constraints of the original? (and also any default values, in this case, since the option to carry them over is not set).
The query has finally died, of its own accord. Still interested to know how to kill such a query without waiting 5 days for a natural death.
This situation came up again, and this time we managed to actively kill the query.
Remember that SVV_TRANSACTIONS query?
txn_start | lock_mode | lockable_object_type | relation | granted
----------------------------+-----------------------+----------------------+----------+---------
2019-03-02 02:14:18.462468 | AccessExclusiveLock | relation | 1 | f
The fact that this lock was not granted was the key.
If the result in the granted column is f (false), the process can't get the lock it needs because another transaction in another session is holding the lock. The blocking_pid column shows the process ID of the session that is holding the lock. In the previous example, PID 19813 is holding the lock.
Use the query from
https://aws.amazon.com/premiumsupport/knowledge-center/prevent-locks-blocking-queries-redshift/
to get the blocking_pid column.
Cancelling the blocking PID allowed us to kill the deep copy.
Very interesting - and thankyou for reporting back on what you found in the end.
I think I've read other people posting here with the same problem - query will not die - and I think also this has always been due to interactions with other queries, so that the query can't die.
When I come across this again, I'll know what to say.
Relevant content
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 5 months ago
- What happens to Amazon RDS and Amazon Redshift queries that are running during a maintenance window?AWS OFFICIALUpdated 4 months ago