Created
May 7, 2018 04:08
-
-
Save 3manuek/53e67f9cc926b1535e926c3b547b448c to your computer and use it in GitHub Desktop.
Calculate bytes per N seconds for estimating speed of restores
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
WITH timeset AS ( | |
select pg_database_size(datname) num, pg_size_pretty(pg_database_size(datname)) size from pg_database where datname = 'db' | |
UNION ALL | |
select pg_database_size(datname) num, pg_size_pretty(pg_database_size(datname)) size from pg_database, pg_sleep(10) where datname = 'db' | |
) | |
SELECT num - lag(num,1) OVER (ORDER BY num) bytes_per_10_second, size FROM timeset | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment