Last active
May 19, 2023 20:38
-
-
Save anarazel/1043f8e6f69cb627a1c008cafd0ddf46 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
WITH | |
constants AS ( | |
SELECT | |
current_setting('server_version') AS version, | |
current_setting('block_size')::int AS block_size, | |
current_setting('autovacuum_vacuum_cost_delay') AS cost_delay, | |
1000 / extract(milliseconds FROM current_setting('autovacuum_vacuum_cost_delay')::interval) AS delays_per_sec, | |
COALESCE(NULLIF(current_setting('autovacuum_vacuum_cost_limit')::int, -1), current_setting('vacuum_cost_limit')::int) AS cost_limit, | |
current_setting('vacuum_cost_page_hit')::int AS cost_hit, | |
current_setting('vacuum_cost_page_miss')::int AS cost_miss, | |
current_setting('vacuum_cost_page_dirty')::int AS cost_dirty | |
), | |
rates AS ( | |
SELECT | |
delays_per_sec * (cost_limit / (cost_hit)) AS hit_clean, | |
delays_per_sec * (cost_limit / (cost_miss)) AS miss_clean, | |
delays_per_sec * (cost_limit / (cost_hit + cost_dirty)) AS hit_dirty, | |
delays_per_sec * (cost_limit / (cost_miss + cost_dirty)) AS miss_dirty | |
FROM constants | |
) | |
SELECT | |
version, | |
pg_size_pretty((block_size * rates.hit_clean)::int8) AS hit_clean_b, | |
pg_size_pretty((block_size * rates.miss_clean)::int8) AS miss_clean_b, | |
pg_size_pretty((block_size * rates.hit_dirty)::int8) AS hit_dirty_b, | |
pg_size_pretty((block_size * rates.miss_dirty)::int8) AS miss_dirty_b, | |
cost_limit, | |
cost_delay, | |
cost_hit, | |
cost_miss, | |
cost_dirty | |
FROM constants, rates; |
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
┌─────────┬─────────────┬──────────────┬─────────────┬──────────────┬────────────┬────────────┬──────────┬───────────┬────────────┐ | |
│ version │ hit_clean_b │ miss_clean_b │ hit_dirty_b │ miss_dirty_b │ cost_limit │ cost_delay │ cost_hit │ cost_miss │ cost_dirty │ | |
├─────────┼─────────────┼──────────────┼─────────────┼──────────────┼────────────┼────────────┼──────────┼───────────┼────────────┤ | |
│ 11.19 │ 78 MB │ 8000 kB │ 3600 kB │ 2400 kB │ 200 │ 20ms │ 1 │ 10 │ 20 │ | |
└─────────┴─────────────┴──────────────┴─────────────┴──────────────┴────────────┴────────────┴──────────┴───────────┴────────────┘ | |
┌─────────┬─────────────┬──────────────┬─────────────┬──────────────┬────────────┬────────────┬──────────┬───────────┬────────────┐ | |
│ version │ hit_clean_b │ miss_clean_b │ hit_dirty_b │ miss_dirty_b │ cost_limit │ cost_delay │ cost_hit │ cost_miss │ cost_dirty │ | |
├─────────┼─────────────┼──────────────┼─────────────┼──────────────┼────────────┼────────────┼──────────┼───────────┼────────────┤ | |
│ 12.14 │ 781 MB │ 78 MB │ 35 MB │ 23 MB │ 200 │ 2ms │ 1 │ 10 │ 20 │ | |
└─────────┴─────────────┴──────────────┴─────────────┴──────────────┴────────────┴────────────┴──────────┴───────────┴────────────┘ | |
┌─────────┬─────────────┬──────────────┬─────────────┬──────────────┬────────────┬────────────┬──────────┬───────────┬────────────┐ | |
│ version │ hit_clean_b │ miss_clean_b │ hit_dirty_b │ miss_dirty_b │ cost_limit │ cost_delay │ cost_hit │ cost_miss │ cost_dirty │ | |
├─────────┼─────────────┼──────────────┼─────────────┼──────────────┼────────────┼────────────┼──────────┼───────────┼────────────┤ | |
│ 13.10 │ 781 MB │ 78 MB │ 35 MB │ 23 MB │ 200 │ 2ms │ 1 │ 10 │ 20 │ | |
└─────────┴─────────────┴──────────────┴─────────────┴──────────────┴────────────┴────────────┴──────────┴───────────┴────────────┘ | |
┌─────────┬─────────────┬──────────────┬─────────────┬──────────────┬────────────┬────────────┬──────────┬───────────┬────────────┐ | |
│ version │ hit_clean_b │ miss_clean_b │ hit_dirty_b │ miss_dirty_b │ cost_limit │ cost_delay │ cost_hit │ cost_miss │ cost_dirty │ | |
├─────────┼─────────────┼──────────────┼─────────────┼──────────────┼────────────┼────────────┼──────────┼───────────┼────────────┤ | |
│ 14.7 │ 781 MB │ 391 MB │ 35 MB │ 35 MB │ 200 │ 2ms │ 1 │ 2 │ 20 │ | |
└─────────┴─────────────┴──────────────┴─────────────┴──────────────┴────────────┴────────────┴──────────┴───────────┴────────────┘ | |
┌─────────┬─────────────┬──────────────┬─────────────┬──────────────┬────────────┬────────────┬──────────┬───────────┬────────────┐ | |
│ version │ hit_clean_b │ miss_clean_b │ hit_dirty_b │ miss_dirty_b │ cost_limit │ cost_delay │ cost_hit │ cost_miss │ cost_dirty │ | |
├─────────┼─────────────┼──────────────┼─────────────┼──────────────┼────────────┼────────────┼──────────┼───────────┼────────────┤ | |
│ 15.2 │ 781 MB │ 391 MB │ 35 MB │ 35 MB │ 200 │ 2ms │ 1 │ 2 │ 20 │ | |
└─────────┴─────────────┴──────────────┴─────────────┴──────────────┴────────────┴────────────┴──────────┴───────────┴────────────┘ | |
┌─────────┬─────────────┬──────────────┬─────────────┬──────────────┬────────────┬────────────┬──────────┬───────────┬────────────┐ | |
│ version │ hit_clean_b │ miss_clean_b │ hit_dirty_b │ miss_dirty_b │ cost_limit │ cost_delay │ cost_hit │ cost_miss │ cost_dirty │ | |
├─────────┼─────────────┼──────────────┼─────────────┼──────────────┼────────────┼────────────┼──────────┼───────────┼────────────┤ | |
│ 16devel │ 781 MB │ 391 MB │ 35 MB │ 35 MB │ 200 │ 2ms │ 1 │ 2 │ 20 │ | |
└─────────┴─────────────┴──────────────┴─────────────┴──────────────┴────────────┴────────────┴──────────┴───────────┴────────────┘ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment