I ran an update statement on a large PostgreSQL table through the phpPgAdmin interface. This timed out as it ran for too long.
I can now update some rows from that table but not all. Trying to update some rows will hang.
Are the rows locked? How can I allow these rows to be updated?
pid = bl. pid WHERE NOT bl. granted; then it returns queries which are waiting to acquire a lock.
PostgreSQL doesn't remember any information about modified rows in memory, so there is no limit on the number of rows locked at one time. However, locking a row might cause a disk write, e.g., SELECT FOR UPDATE modifies selected rows to mark them locked, and so will result in disk writes.
It's possible to see the locks.
Here is a view to make it a bit easier than using pg_locks directly:
CREATE OR REPLACE VIEW public.active_locks AS   SELECT t.schemaname,     t.relname,     l.locktype,     l.page,     l.virtualtransaction,     l.pid,     l.mode,     l.granted    FROM pg_locks l    JOIN pg_stat_all_tables t ON l.relation = t.relid   WHERE t.schemaname <> 'pg_toast'::name AND t.schemaname <> 'pg_catalog'::name   ORDER BY t.schemaname, t.relname;   Then you just select from the view:
SELECT * FROM active_locks;   And kill it with:
SELECT pg_cancel_backend('%pid%');   Other solutions: http://wiki.postgresql.org/wiki/Lock_Monitoring
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With