Created
September 21, 2018 00:56
-
-
Save abevieiramota/b31adeb7ca1db0f58384fbbff3f5a79b to your computer and use it in GitHub Desktop.
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
-- salva statistics de uso de tabelas | |
create temporary table "Abelardo Vieira Mota" as | |
select * from pg_catalog.pg_stat_user_tables; | |
-- SQL qualquer | |
-- verifica que mudanças houve | |
select | |
n.schemaname, n.relname, | |
t.seq_scan - n.seq_scan as seq_scan, | |
t.idx_scan - n.idx_scan as idx_scan, | |
t.n_tup_ins - n.n_tup_ins as tup_ins, | |
t.n_tup_upd - n.n_tup_upd as tup_upd, | |
t.n_tup_del - n.n_tup_del as tup_del | |
from pg_catalog.pg_stat_user_tables t | |
inner join "Abelardo Vieira Mota" n on n.relid = t.relid | |
and (n.seq_scan, n.idx_scan, n.n_tup_ins, n.n_tup_upd, n.n_tup_del) <> | |
(t.seq_scan, t.idx_scan, t.n_tup_ins, t.n_tup_upd, t.n_tup_del); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment