-
Notifications
You must be signed in to change notification settings - Fork 2
/
pg_sortstats--0.0.1.sql
39 lines (34 loc) · 1.09 KB
/
pg_sortstats--0.0.1.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
-- This program is open source, licensed under the PostgreSQL License.
-- For license terms, see the LICENSE file.
--
-- Copyright (C) 2018-2023: The PoWA-team
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pg_sortstats" to load this file. \quit
SET client_encoding = 'UTF8';
CREATE FUNCTION pg_sortstats(IN showtext boolean,
OUT queryid bigint,
OUT userid oid,
OUT dbid oid,
OUT nb_keys integer,
OUT sort_keys text,
OUT lines bigint,
OUT lines_to_sort bigint,
OUT work_mems bigint,
OUT topn_sorts bigint,
OUT quicksorts bigint,
OUT external_sorts bigint,
OUT external_merges bigint,
OUT nb_tapes bigint,
OUT space_disk bigint,
OUT space_memory bigint,
OUT non_parallels bigint,
OUT nb_workers bigint
)
RETURNS SETOF record
AS '$libdir/pg_sortstats', 'pg_sortstats'
LANGUAGE C STRICT VOLATILE COST 1000;
CREATE VIEW pg_sortstats AS SELECT * FROM pg_sortstats(true);
CREATE FUNCTION pg_sortstats_reset()
RETURNS void
LANGUAGE c COST 1000
AS '$libdir/pg_sortstats', 'pg_sortstats_reset';