-
Notifications
You must be signed in to change notification settings - Fork 0
/
plprofiler--2.0--3.0.sql
149 lines (125 loc) · 3.95 KB
/
plprofiler--2.0--3.0.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "ALTER EXTENSION plprofiler UPDATE TO '3.0'" to load this file. \quit
-- We don't preserve any
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_linestats(bool);
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_callgraph(bool);
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_func_oids_current();
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_funcs_source(oid[]);
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_get_stack(oid[]);
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_reset();
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_enable(bool);
ALTER EXTENSION plprofiler DROP FUNCTION pl_profiler_collect_data();
DROP FUNCTION pl_profiler_linestats(bool);
DROP FUNCTION pl_profiler_callgraph(bool);
DROP FUNCTION pl_profiler_func_oids_current();
DROP FUNCTION pl_profiler_funcs_source(oid[]);
DROP FUNCTION pl_profiler_get_stack(oid[]);
DROP FUNCTION pl_profiler_reset();
DROP FUNCTION pl_profiler_enable(bool);
DROP FUNCTION pl_profiler_collect_data();
ALTER EXTENSION plprofiler DROP TABLE pl_profiler_linestats_data;
ALTER EXTENSION plprofiler DROP TABLE pl_profiler_callgraph_data;
DROP TABLE pl_profiler_linestats_data;
DROP TABLE pl_profiler_callgraph_data;
-- Register functions.
CREATE FUNCTION pl_profiler_linestats_local(
OUT func_oid oid,
OUT line_number int8,
OUT exec_count int8,
OUT total_time int8,
OUT longest_time int8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C ROWS 1000000;
GRANT EXECUTE ON FUNCTION pl_profiler_linestats_local() TO public;
CREATE FUNCTION pl_profiler_linestats_shared(
OUT func_oid oid,
OUT line_number int8,
OUT exec_count int8,
OUT total_time int8,
OUT longest_time int8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C ROWS 1000000;
CREATE FUNCTION pl_profiler_callgraph_local(
OUT stack oid[],
OUT call_count int8,
OUT us_total int8,
OUT us_children int8,
OUT us_self int8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C ROWS 1000000;
GRANT EXECUTE ON FUNCTION pl_profiler_callgraph_local() TO public;
CREATE FUNCTION pl_profiler_callgraph_shared(
OUT stack oid[],
OUT call_count int8,
OUT us_total int8,
OUT us_children int8,
OUT us_self int8
)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C ROWS 1000000;
CREATE FUNCTION pl_profiler_func_oids_local()
RETURNS oid[]
AS 'MODULE_PATHNAME'
LANGUAGE C;
GRANT EXECUTE ON FUNCTION pl_profiler_func_oids_local() TO public;
CREATE FUNCTION pl_profiler_func_oids_shared()
RETURNS oid[]
AS 'MODULE_PATHNAME'
LANGUAGE C;
CREATE FUNCTION pl_profiler_funcs_source(
IN func_oids oid[],
OUT func_oid oid,
OUT line_number int8,
OUT source text
)
RETURNS SETOF record
AS 'MODULE_PATHNAME'
LANGUAGE C ROWS 1000000;
GRANT EXECUTE ON FUNCTION pl_profiler_funcs_source(oid[]) TO public;
CREATE FUNCTION pl_profiler_get_stack(stack oid[])
RETURNS text[]
AS 'MODULE_PATHNAME'
LANGUAGE C;
GRANT EXECUTE ON FUNCTION pl_profiler_get_stack(oid[]) TO public;
CREATE FUNCTION pl_profiler_reset_local()
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C;
GRANT EXECUTE ON FUNCTION pl_profiler_reset_local() TO public;
CREATE FUNCTION pl_profiler_reset_shared()
RETURNS void
AS 'MODULE_PATHNAME'
LANGUAGE C;
CREATE FUNCTION pl_profiler_enable(enabled bool)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C;
GRANT EXECUTE ON FUNCTION pl_profiler_enable(bool) TO public;
CREATE FUNCTION pl_profiler_collect_data()
RETURNS int4
AS 'MODULE_PATHNAME'
LANGUAGE C;
CREATE FUNCTION pl_profiler_callgraph_overflow()
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C;
CREATE FUNCTION pl_profiler_functions_overflow()
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C;
CREATE FUNCTION pl_profiler_lines_overflow()
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C;
-- Add new columns to table pl_profiler_saved
ALTER TABLE pl_profiler_saved
ADD COLUMN s_callgraph_overflow bool,
ADD COLUMN s_function_overflow bool,
ADD COLUMN s_lines_overflow bool;