Sha256: 21ddccc25017c6d6767a697dda11539f79c492e5e2c3e45805d3d4f2af34ec27

Contents?: true

Size: 537 Bytes

Versions: 67

Compression:

Stored size: 537 Bytes

Contents

/* Queries holding locks other queries are waiting to be released */

SELECT bl.pid AS blocked_pid,
  ka.query AS blocking_statement,
  now() - ka.query_start AS blocking_duration,
  kl.pid AS blocking_pid,
  a.query AS blocked_statement,
  now() - a.query_start AS blocked_duration
FROM pg_catalog.pg_locks bl
JOIN pg_catalog.pg_stat_activity a
  ON bl.pid = a.pid
JOIN pg_catalog.pg_locks kl
  JOIN pg_catalog.pg_stat_activity ka
    ON kl.pid = ka.pid
ON bl.transactionid = kl.transactionid AND bl.pid != kl.pid
WHERE NOT bl.granted;

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
ruby-pg-extras-5.2.1 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-5.2.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-5.1.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-5.0.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.13.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.12.2 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.12.1 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.12.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.11.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.10.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.9.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.8.1 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.7.2 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.7.1 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.7.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.6.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.5.1 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.5.0 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.4.4 lib/ruby_pg_extras/queries/blocking.sql
ruby-pg-extras-4.4.3 lib/ruby_pg_extras/queries/blocking.sql