Обсуждение: VIP: explain of running query
Hi
I am sending a prototype with basic implementation with explain of running query specified by pid.
It can show more than the execution plan. There is a examples of full query text and running completion tag.I am sending a prototype with basic implementation with explain of running query specified by pid.
postgres=# select pg_cmdstatus(pid,1) from pg_stat_activity where pid <> pg_backend_pid();
pg_cmdstatus
-------------------------------------------------------------------------------
Query Text: select * from pg_class, pg_attribute limit 4000000;
Limit (cost=0.00..8795.58 rows=697380 width=403)
-> Nested Loop (cost=0.00..8795.58 rows=697380 width=403)
-> Seq Scan on pg_attribute (cost=0.00..66.64 rows=2364 width=203)
-> Materialize (cost=0.00..12.42 rows=295 width=200)
-> Seq Scan on pg_class (cost=0.00..10.95 rows=295 width=200)
(6 rows)
postgres=# select pg_cmdstatus(pid,2) from pg_stat_activity where pid <> pg_backend_pid();
pg_cmdstatus
-----------------------------------------------------
select * from pg_class, pg_attribute limit 4000000;
(1 row)
postgres=# select pg_cmdstatus(pid,3) from pg_stat_activity where pid <> pg_backend_pid();
pg_cmdstatus
---------------
SELECT 144427
(1 row)
postgres=# select pg_cmdstatus(pid,3) from pg_stat_activity where pid <> pg_backend_pid();
pg_cmdstatus
---------------
SELECT 209742
(1 row)
postgres=# select pg_cmdstatus(pid,3) from pg_stat_activity where pid <> pg_backend_pid();
pg_cmdstatus
---------------
SELECT 288472
(1 row)
http://www.postgresql.org/message-id/CAFj8pRA-DuzkmDtu52CiUgb0P7TVri_B8LtjMJfWcnr1LPts6w@mail.gmail.com
http://www.postgresql.org/message-id/CAFj8pRDEo24joEg4UFRDYeFADFTw-jw_=t=kPwOyDW=v=g1Fhg@mail.gmail.com
Pavel