Created
March 27, 2014 18:54
-
-
Save jberkus/9815260 to your computer and use it in GitHub Desktop.
Flexible Freeze outline
This file contains 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
Specification: | |
BASIC VERSION | |
Config File: | |
Series of time windows for "low traffic" points. | |
e.g. "Sunday 1am-4am" | |
Postgres connection info for 1 database | |
vacuum settings | |
min_freeze threshold (default 1,000,000) | |
pause between freeze length (default 1 minute) | |
Actions: | |
1. Called by Cron every hour | |
2. Checks if it's already running. If so, quits. | |
3. Checks if it's in a freeze time window. If not, quits. | |
4. Gets list of unfrozen relations, sorted by oldest XID, minimum per config | |
5. Loops through relations one at a time: | |
a. Checks if still in time window (if not, exits) | |
b. Does VACUUM FREEZE with config settings | |
c. Pauses per config | |
6. When it runs out of relations or time, exits. | |
Requirements | |
Perl or Python | |
PostgreSQL drivers | |
Cron | |
ADVANCED VERSION | |
Same as basic version, except: | |
A. Supports multiple databases | |
B. Supports checks on system load, concurrent transactions, and wait status | |
with thresholds for quitting if load is too high | |
C. Supports multiple threads for parallel freeezing | |
D. Kills running VACUUM at end of time window if still running. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment