1 /* pg_store_plans/pg_store_plans--1.4.sql */
3 -- complain if script is sourced in psql, rather than via CREATE EXTENSION
4 \echo Use "CREATE EXTENSION pg_store_plans" to load this file. \quit
7 CREATE FUNCTION pg_store_plans_reset()
11 CREATE FUNCTION pg_store_plans_shorten(text)
15 RETURNS NULL ON NULL INPUT;
16 CREATE FUNCTION pg_store_plans_normalize(text)
20 RETURNS NULL ON NULL INPUT;
21 CREATE FUNCTION pg_store_plans_jsonplan(text)
25 RETURNS NULL ON NULL INPUT;
26 CREATE FUNCTION pg_store_plans_textplan(text)
30 RETURNS NULL ON NULL INPUT;
31 CREATE FUNCTION pg_store_plans_yamlplan(text)
35 RETURNS NULL ON NULL INPUT;
36 CREATE FUNCTION pg_store_plans_xmlplan(text)
40 RETURNS NULL ON NULL INPUT;
41 CREATE FUNCTION pg_store_plans_hash_query(text)
45 RETURNS NULL ON NULL INPUT;
46 CREATE FUNCTION pg_store_plans(
51 OUT queryid_stat_statements int8,
54 OUT total_time float8,
58 OUT stddev_time float8,
60 OUT shared_blks_hit int8,
61 OUT shared_blks_read int8,
62 OUT shared_blks_dirtied int8,
63 OUT shared_blks_written int8,
64 OUT local_blks_hit int8,
65 OUT local_blks_read int8,
66 OUT local_blks_dirtied int8,
67 OUT local_blks_written int8,
68 OUT temp_blks_read int8,
69 OUT temp_blks_written int8,
70 OUT blk_read_time float8,
71 OUT blk_write_time float8,
72 OUT first_call timestamptz,
73 OUT last_call timestamptz
79 -- Register a view on the function for ease of use.
80 CREATE VIEW pg_store_plans AS
81 SELECT * FROM pg_store_plans();
83 GRANT SELECT ON pg_store_plans TO PUBLIC;
85 -- Don't want this to be available to non-superusers.
86 REVOKE ALL ON FUNCTION pg_store_plans_reset() FROM PUBLIC;