OSDN Git Service

Ignore psqlrc file in make rules relying on psql.
[pgstoreplans/pg_store_plans.git] / pg_store_plans--1.6.sql
1 /* pg_store_plans/pg_store_plans--1.6.sql */
2
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
5
6 -- Register functions.
7 CREATE FUNCTION pg_store_plans_reset()
8 RETURNS void
9 AS 'MODULE_PATHNAME'
10 LANGUAGE C;
11 CREATE FUNCTION pg_store_plans_shorten(text)
12 RETURNS text
13 AS 'MODULE_PATHNAME'
14 LANGUAGE C
15 RETURNS NULL ON NULL INPUT;
16 CREATE FUNCTION pg_store_plans_normalize(text)
17 RETURNS text
18 AS 'MODULE_PATHNAME'
19 LANGUAGE C
20 RETURNS NULL ON NULL INPUT;
21 CREATE FUNCTION pg_store_plans_jsonplan(text)
22 RETURNS text
23 AS 'MODULE_PATHNAME'
24 LANGUAGE C
25 RETURNS NULL ON NULL INPUT;
26 CREATE FUNCTION pg_store_plans_textplan(text)
27 RETURNS text
28 AS 'MODULE_PATHNAME'
29 LANGUAGE C
30 RETURNS NULL ON NULL INPUT;
31 CREATE FUNCTION pg_store_plans_yamlplan(text)
32 RETURNS text
33 AS 'MODULE_PATHNAME'
34 LANGUAGE C
35 RETURNS NULL ON NULL INPUT;
36 CREATE FUNCTION pg_store_plans_xmlplan(text)
37 RETURNS text
38 AS 'MODULE_PATHNAME'
39 LANGUAGE C
40 RETURNS NULL ON NULL INPUT;
41 CREATE FUNCTION pg_store_plans_hash_query(text)
42 RETURNS oid
43 AS 'MODULE_PATHNAME'
44 LANGUAGE C
45 RETURNS NULL ON NULL INPUT;
46 CREATE FUNCTION pg_store_plans(
47     OUT userid oid,
48     OUT dbid oid,
49     OUT queryid int8,
50     OUT planid int8,
51     OUT queryid_stat_statements int8,
52     OUT plan text,
53     OUT calls int8,
54     OUT total_time float8,
55     OUT min_time float8,
56     OUT max_time float8,
57     OUT mean_time float8,
58     OUT stddev_time float8,
59     OUT rows int8,
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
74 )
75 RETURNS SETOF record
76 AS 'MODULE_PATHNAME'
77 LANGUAGE C;
78
79 -- Register a view on the function for ease of use.
80 CREATE VIEW pg_store_plans AS
81   SELECT * FROM pg_store_plans();
82
83 GRANT SELECT ON pg_store_plans TO PUBLIC;
84
85 -- Don't want this to be available to non-superusers.
86 REVOKE ALL ON FUNCTION pg_store_plans_reset() FROM PUBLIC;