1 /* pg_store_plans/pg_store_plans--1.0.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,
56 OUT shared_blks_hit int8,
57 OUT shared_blks_read int8,
58 OUT shared_blks_dirtied int8,
59 OUT shared_blks_written int8,
60 OUT local_blks_hit int8,
61 OUT local_blks_read int8,
62 OUT local_blks_dirtied int8,
63 OUT local_blks_written int8,
64 OUT temp_blks_read int8,
65 OUT temp_blks_written int8,
66 OUT blk_read_time float8,
67 OUT blk_write_time float8,
68 OUT first_call timestamptz,
69 OUT last_call timestamptz
75 -- Register a view on the function for ease of use.
76 CREATE VIEW pg_store_plans AS
77 SELECT * FROM pg_store_plans();
79 GRANT SELECT ON pg_store_plans TO PUBLIC;
81 -- Don't want this to be available to non-superusers.
82 REVOKE ALL ON FUNCTION pg_store_plans_reset() FROM PUBLIC;