Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable truncating when vacuuming #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions scripts/flexible_freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def timestamp():
help="Do VACUUM ANALYZE instead of VACUUM FREEZE ANALYZE")
parser.add_argument("--no-analyze", dest="skip_analyze", action="store_true",
help="Do not do an ANALYZE as part of the VACUUM operation")
parser.add_argument("--no-truncate", dest="skip_truncate", action="store_true",
help="Do not truncate off empty pages as part of the VACUUM operation")
parser.add_argument("--vacuum", dest="vacuum", action="store_true",
help="Do VACUUM ANALYZE instead of VACUUM FREEZE ANALYZE (deprecated option; use --no-freeze instead)")
parser.add_argument("--pause", dest="pause_time", type=int, default=10,
Expand Down Expand Up @@ -310,10 +312,15 @@ def signal_handler(signal, frame):

# if not, vacuum or freeze
exquery = "VACUUM "
options = []
if not args.skip_freeze:
exquery += "FREEZE "
options.append("FREEZE")
if not args.skip_analyze:
exquery += "ANALYZE "
options.append("ANALYZE")
if args.skip_truncate:
options.append("TRUNCATE false")
if options:
exquery += "(%s) " % ", ".join(options)

exquery += '"%s"' % table

Expand Down