~launchpad-pqm/launchpad/devel

7675.395.176 by Stuart Bishop
Capture table disk utilization metrics from pgstattuple
1
SET client_min_messages TO error;
2
3
CREATE TABLE DatabaseDiskUtilization (
4
    date_created timestamp without time zone
5
        DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
6
    namespace text NOT NULL,
7
    name text NOT NULL,
8
    sub_namespace text,
9
    sub_name text,
10
    kind char NOT NULL,
11
    sort text NOT NULL,
12
    table_len bigint NOT NULL,
13
    tuple_count bigint NOT NULL,
14
    tuple_len bigint NOT NULL,
15
    tuple_percent float8 NOT NULL,
16
    dead_tuple_count bigint NOT NULL,
17
    dead_tuple_len bigint NOT NULL,
18
    dead_tuple_percent float8 NOT NULL,
19
    free_space bigint NOT NULL,
20
    free_percent float8 NOT NULL,
21
    CONSTRAINT databasediskutilization_pkey PRIMARY KEY (date_created, sort)
22
    ) WITH (fillfactor=100);
23
24
CREATE OR REPLACE VIEW LatestDatabaseDiskUtilization AS
25
SELECT * FROM DatabaseDiskUtilization
26
WHERE date_created = (SELECT max(date_created) FROM DatabaseDiskUtilization);
27
28
7675.395.177 by Stuart Bishop
Renumber DB patch
29
INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 43, 0);