Permalink
Browse files

Allow database version to be targeted in command line - change defaul…

…t from 8.4 to 9.1
  • Loading branch information...
Eric Litwin
Eric Litwin committed Mar 14, 2014
1 parent 83e1369 commit 1f9415ed4273b1dcda9c97882f8ba82508b7a0fb
Showing with 18 additions and 6 deletions.
  1. +1 −0 pg_settings-9.1-64
  2. +17 −6 pgtune
View
@@ -195,6 +195,7 @@ vacuum_defer_cleanup_age 0 Replication / Master Server Number of transactions b
vacuum_freeze_min_age 50000000 Client Connection Defaults / Statement Behavior Minimum age at which VACUUM should freeze a table row. \N user integer 0 1000000000 \N 50000000
vacuum_freeze_table_age 150000000 Client Connection Defaults / Statement Behavior Age at which VACUUM should scan whole table to freeze tuples. \N user integer 0 2000000000 \N 150000000
wal_block_size 8192 Preset Options Shows the block size in the write ahead log. \N internal integer 8192 8192 \N 8192
wal_buffers 8 8kB Write-Ahead Log / Settings Sets the number of disk-page buffers in shared memory for WAL. \N postmaster integer 4 2147483647 \N 8
wal_keep_segments 0 Replication / Master Server Sets the number of WAL files held for standby servers. \N sighup integer 0 2147483647 \N 0
wal_level minimal \N Write-Ahead Log / Settings Set the level of information written to the WAL. \N postmaster enum \N \N {minimal,archive,hot_standby} minimal
wal_receiver_status_interval 10 s Replication / Standby Servers Sets the maximum interval between WAL receiver status reports to the primary. \N sighup integer 0 2147483 \N 10
View
23 pgtune
@@ -334,15 +334,19 @@ class PGSettings(object):
self.param_to_dict = {}
self.settings_dir = settings_dir
def read_config_file(self):
def read_config_file(self, options):
platform_bits = 32
if platform.architecture()[0] == "64bit":
platform_bits = 64
# TODO Support handling versions other than 8.4
# TODO Allow passing in platform bit size
# TODO Map higher version to lowest available settings file
# e.g. -v 9.3 should map to pg_settings-9.1 file unless
# a pg_settings-9.3 file exists
version = options.version.lower()
setting_dump_file = os.path.join(self.settings_dir,
"pg_settings-8.4-%s" % platform_bits)
"pg_settings-%s-%s"
%(version, platform_bits))
setting_columns = ["name", "setting", "unit", "category", "short_desc",
"extra_desc", "context", "vartype", "min_val",
"max_val", "enumvals", "boot_val"]
@@ -583,8 +587,8 @@ def wizard_tune(config, options, settings):
"-------------------------------------------"
config.identify_session(delim)
config.identify_session("# pgtune run on %s" % (datetime.date.today()))
config.identify_session("# Based on %s KB RAM, platform %s"
% (mem,options.platform))
config.identify_session("# Based on %s KB RAM, platform %s, version %s"
% (mem,options.platform,options.version))
config.identify_session(delim)
config.identify_session("")
@@ -631,6 +635,13 @@ def read_options(program_args):
help="Database type, defaults to Mixed. " \
"Valid options are DW, OLTP, Web, Mixed, Desktop")
parser.add_option('-V',
'--version',
dest="version",
default="9.1",
help="PostgreSQL database version to tune for. " \
"Valid options are 8.4, 9.0, and 9.1")
parser.add_option('-P',
'--platform',
dest="platform",
@@ -700,7 +711,7 @@ def main(program_args):
options.settings_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
settings = PGSettings(options.settings_dir)
settings.read_config_file()
settings.read_config_file(options)
config.store_settings(settings)
wizard_tune(config, options, settings)

0 comments on commit 1f9415e

Please sign in to comment.