Answer the question
In order to leave comments, you need to log in
How to clear a table?
I have a table with 5,000,000 records and I ran the TRUNCATE table_name CASCADE command and ... this command has been running for 48 hours now?
Please tell us how to clean the table as quickly as possible and how to organize monitoring.
Answer the question
In order to leave comments, you need to log in
If truncate is executed for more than a second, then truncate is not executed at all, but is waiting for a lock.
Look in pg_stat_activity where state != 'idle' for long running transactions.
Or immediately with a request for pg_locks, for example, like this: https://github.com/dataegret/pg-utils/blob/master/...
Normal monitoring is a separate, complex and sad issue.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question