This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\pset pager off | |
\set ECHO all | |
\set ON_ERROR_STOP 0 | |
select version(); | |
\dx | |
select now(); | |
\x off | |
SELECT datname, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\pset pager off | |
\set ECHO all | |
\set ON_ERROR_STOP 0 | |
select version(); | |
\dx | |
select now() | |
\x off | |
select * from _prom_catalog.ha_leases |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\timing on | |
with info as ( | |
SELECT | |
stat.relid as relid, | |
stat.relid::regclass as regclass, | |
age(c.relfrozenxid) > current_setting('vacuum_freeze_min_age')::int | |
and age(c.relfrozenxid) > current_setting('vacuum_freeze_table_age')::int autovacuum_can_freeze, | |
ROUND(100*(age(c.relfrozenxid)/current_setting('vacuum_freeze_table_age')::float)) as perc_to_frozen, | |
ROUND(100*(age(c.relfrozenxid)/ current_setting('autovacuum_freeze_max_age')::float)) perc_to_wrap, | |
CASE WHEN c.reltuples > 0 THEN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\pset pager off | |
\set ECHO all | |
\set ON_ERROR_STOP 0 | |
select version(); | |
\dx | |
select now(); | |
--sanity_check: avg_not_yet_compressed_chunks is < 2 | |
\x on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; | |
CREATE OR REPLACE FUNCTION uuid_timestamp(uuid UUID) RETURNS TIMESTAMPTZ AS $$ | |
DECLARE | |
bytes bytea; | |
BEGIN | |
bytes := uuid_send(uuid); | |
if (get_byte(bytes, 6) >> 4)::int2 != 1 then | |
RAISE EXCEPTION 'UUID version is not 1'; |