Last active
August 29, 2019 14:59
-
-
Save leonardoo/c72d28846de422ad03166acc0f3fad40 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
restore db without owner | |
pg_restore -U user -d db -1 db.sql -O --no-owner | |
psql -d db -f file.dump -U user -W -h host | |
sie db | |
SELECT | |
nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_relation_size(C.oid)) AS "size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
ORDER BY pg_relation_size(C.oid) DESC | |
LIMIT 20; | |
vaccum | |
VACUUM VERBOSE ANALYZE public.bus_buslocation; | |
VACUUM VERBOSE ANALYZE public.statistic_location; | |
VACUUM VERBOSE ANALYZE public.bus_busspeed; | |
VACUUM VERBOSE ANALYZE public.bus_buslog; | |
REINDEX SCHEMA public; | |
#see dead tuples | |
SELECT relname,n_tup_ins as "inserts",n_tup_upd as "updates",n_tup_del as "deletes", n_live_tup as "live_tuples", n_dead_tup as "dead_tuples" | |
FROM pg_stat_user_tables | |
WHERE schemaname = 'public' order by n_dead_tup desc; | |
select relname,last_autovacuum,autovacuum_count, | |
last_autoanalyze from pg_stat_user_tables where schemaname = 'public' order by relname ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment