pax_global_header00006660000000000000000000000064112721663670014525gustar00rootroot0000000000000052 comment=dc4f2d8617d9902929436651837afc77a3a9207f pgtune-0.9.3/000077500000000000000000000000001127216636700130405ustar00rootroot00000000000000pgtune-0.9.3/COPYRIGHT000066400000000000000000000027051127216636700143370ustar00rootroot00000000000000Copyright (c) 2009, Gregory Smith All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pgtune-0.9.3/README000066400000000000000000000102211127216636700137140ustar00rootroot00000000000000Introduction ============ pgtune takes the wimpy default postgresql.conf and expands the database server to be as powerful as the hardware it's being deployed on. Installation/Usage ================== Source installation ------------------- There is no need to build/compile pgtune, it is a Python script. Extracting tarball to a convenient location is sufficient. Note that you will need the multiple RPM Installation ---------------- The RPM package installs: * The pgtune binary under/usr/bin * Documents in /usr/share/doc/pgtune-$version * Setting files in /usr/share/pgtune Using pgtune ============ pgtune works by taking an existing postgresql.conf file as an input, making changes to it based on the amount of RAM in your server and suggested workload, and output a new file. Here's a sample usage:: pgtune -i $PGDATA/postgresql.conf -o $PGDATA/postgresql.conf.pgtune pgtune --help will give you additional usage information. These are the current parameters: * -i or --input-config : Specifies the current postgresql.conf file. * -o or --input-config : Specifies the file name for the new postgresql.conf file. * -M or --memory: Use this parameter to specify total system memory. If not specified, pgtune will attempt to detect memory size. * -T or --type : Specifies database type. Valid options are: DW, OLTP, Web, Mixed, Desktop * -c or --connections: Specifies number of maximum connections expected. If not specified, it depends on database type. * -D or --debug : Enables debugging mode. * -S or --settings: Directory where settings data files are located at. Defaults to the directory where the script is being run from. The RPM package includes a patch to use the correct location these files were installed into. Todo ==== A TODO list is included in the tarball. There are also some TODO items marked in the source code itself. Bugs ==== There aren't any known bugs, besides the cleanup areas mentioned in the source code with TODO tags. These shouldn't impact use of the program. If you find a bug, there is a tracker on the pgfoundry page for pgtune listed below. Documentation ============= The documentation README for pgtune is in ReST markup. Tools that operate on ReST can be used to make versions of it formatted for other purposes, such as rst2html to make a HTML version. Contact ======= * The project is hosted at http://pgfoundry.org/projects/pgtune * Initial commits are done in the git reportiory at http://git.postgresql.org/git/pgtune.git. If you have any hints, changes or improvements, please contact: * Greg Smith gsmith@gregsmith.com License ======= pgtune is licensed under a standard 3-clause BSD license. Copyright (c) 2009, Gregory Smith All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pgtune-0.9.3/TODO000066400000000000000000000217361127216636700135410ustar00rootroot00000000000000Features needed before V1.0 release =================================== Settings information Validate against min/max - stub Figure out how to deal with delimiters - stub For memory, handle the same memory input formats as the database Format output so it looks nicer Warning about listen_addresses if it's not set to '*'-input parameter? Show original value in output Put a pgconftune header before any changed settings Limit shared memory use on Windows Platform specific details Hint for <256MB case Look for postgresql.conf file using PGDATA Look for settings files based on path of executable Output sysctl.conf suggestion Test on Mac as additional OS Test on Linux + Python 2.5, reported ValueError on wintypes via list Model Estimate shared memory use Docs Describe all the types clearly, refer to docs in usage notes Suggest where the settings are still conservative Data warehouse: more stats, turn off auto vacuum Does not account for application overhead, can reduce total mem if that's the case Targets using 1/4 for shared_buffers, up to 1/2 for work_mem, and typically an additional 1/2 of the OS buffer cache May not correctly parse existing values if you have manually increased either BLCKSZ or XLOG_BLCKSZ; should still set values correctly though. Minimal systems should just use what comes out of initdb Outline of main desired features ================================ Config file class: Interpret input units Strip out items set to the default Strip out comments V2.0 features Wizard to ask questions Real GUI Brief versus verbose, removing comments Collect comments that appear in the default config to allow stripping them out Set max_prepared_transactions Set FSM parameters Add 8.3, 8.2, 8.1 compatibility List of parameters not to mess with (collate, archive_command) may be needed for more advanced generation stuff Allow overriding the OS information for sysctl output Extend model to work properly on systems with smaller amounts of RAM aimed at a small number of users Python systems information ========================== system parameter SC_INT_MAX will tell us what kind of platform we're on? SC_INT_MAX 2147483647 SC_NPROCESSORS_CONF 4 Available via platform information--it looks at the size of a pointer Notes about pg-generate-conf ============================ pg_generate_conf would take the following switches: * -b , --basic — short conf file, listing only the 15-18 most commonly changed options * -a , --advanced — conf file listing all 196+ options * -t, --terse — conf file lists only category headings and actual settings, no comments * -n, --normal — conf file has category and subcategory settings, with short, descriptive comments * -v, --verbose — conf file lists full descriptions and recommendations in comments with each option * -c "option = value" set specific option to specific value in the file * -f "filename" — take options and values from file "filename" The default would be "-b, -n", with specific settings for shared_buffers and wal_sync_method. The current postgresql.conf is a lot more like a "-a, -v" file. Initial Review ============== The following section is notes from Josh Berkus after reviewing the first pgtune prototype released: Solicit the following information from the user: -- Available RAM -- Expected Database Size (to nearest 10x) -- Type of Application -- Web -- Data Warehouse -- Mixed -- Desktop -- Operating System [Linux/Windows/OSX/Solaris/FreeBSD/other] From the above, you can derive all necessary calculations for the basics. In the advanced version, we'll also want to ask: -- Memory used by other applications on the system? -- Analyze queries for performance? -- SSL? -- Production vs. Development status? -- How many connections? -- Logging setup: Syslog Analyze Performance Private log with weekly rotation It's completely unnecessary to account for OS overhead. This can and should be taken into account as part of the calculations for other figures. For example, my 1/4 and 3/4 calculations ignore OS overhead. You only need to reduce Available RAM when the server will be running something else, like a J2EE server or multiple databases. The FSM stuff is not be necessary if targeting 8.4. Values: web: max_fsm_pages = DBsize / PageSize / 8 oltp: max_fsm_pages = DBsize / PageSize / 8 DW: max_fsm_pages = DBsize / PageSize / 32 (unless LoadSize is known) Mixed: max_fsm_pages = DBsize / PageSize / 8 Desktop: max_fsm_pages = DBsize / PageSize / 8 The specific elements of a "DW" use-case aren't necessarily tied to size. They are: * data comes in in large batches rather than individual rows * small numbers of users * large complex queries For example, right now, I'm refactoring a database which is only 15GB, but is definitely DW behavior, so we want to keep max_connections to < 20 and turn autovaccum off. So I think we should ask the user what kind of DB they have (*with* docs which explain what the types mean) and fall back to testing by size if the info is not supplied. Regarding the level of default_stats_target, it sounds like people agree that it ought to be raised for the DW use-case, but disagree how much. If that's the case, what if we compromize at 50 for "mixed" and 100 for DW? That should allay people's fears, and we can tinker with it when we have more data. The question is what value represents a good trade-off between the costs of having large stats targets -- longer analyze, more data stored in pg_statistics, more vacuuming of pg_statistics needed, longer plan times -- and the benefits of having larger stats targets -- fewer columns which need raised stats targets. Controversial Settings ====================== -checkpoint_segments in the OLTP case should be larger -Allocating work_mem: total ram/connections seems a little scant in web / oltp case, but with the high connections it could make sense -Going that large with statistics target -I don't need DB size if I'm not setting the fsm stuff; leave that out of V8.4 targeted release -Put a cap on maint_work_mem at 1GB Parsing Input Units =================== parse_int is the routine kB MB and GB are only accepted ones Some parameters are "GUC_UNIT_MEMORY"; these are the ones this logic applies to These are ones where the unit name ends with kB Raw integers are considered in kb unless they are blocksz or xlog_blcksz ones #define KB_PER_MB (1024) #define KB_PER_GB (1024*1024) kB: Divided by (unit size)/kb (typically =8) to get kB MB: Multplied by KB_PER_MB , divided as above GB: Multiplied by KB_PER_GB There are also unit of time variables, don't care about those right now This is the logic that maps the block size stuff into the units field: case GUC_UNIT_KB: values[2] = "kB"; case GUC_UNIT_BLOCKS: snprintf(buf, sizeof(buf), "%dkB", BLCKSZ / 1024); case GUC_UNIT_XBLOCKS: snprintf(buf, sizeof(buf), "%dkB", XLOG_BLCKSZ / 1024); So I don't have to worry about that; I can just use the unit size as kB For booleans, on and off are the officially supported version of those values, but many others are accepted too Hint interface ============== One option for displaying suggestions is a hint interface that goes to standard error. Sample hints: # HINT: Increase SHMMAX # HINT: You won't be able to connect to this database over TCP/IP with your listen_address setting # HINT: The value for max_connections is being reduced from $X to $Y # HINT: Expected maximum memory use for this configuration: $X (pretty printed) # HINT: Autovacuum is off # HINT: If you aren't using partitions, you can improve query planning time by turning constraint_exclusion off # HINT: Windows doesn't handle large numbers of connections # HINT: Consider a conneciton pooler Would be nice to make all the hints show up as comments in case they are mixed together. That will make the SHMMAX example much less useful though Python review notes =================== -from ctypes import * ( 18 ) makes the block difficult to read and pollutes the namespace. -The doc strings ( 59, 136, 206 ) don't follow standard conventions, described here http://www.python.org/dev/peps/pep-0257/. -Functions also support doc strings ( 342, 351, etc. ) Sample usage ============ ./pgtune -i /home/gsmith/data/3.0.12/postgresql.conf --type="OLTP" -o out.conf Estimating shared memory usage ============================== http://www.postgresql.org/docs/current/static/kernel-resources.html Introduce a platform structure I pass around everywhere that abstracts away OS, memory, version, PostgreSQL version, etc. Introduce an "info" option that will show all the information in there, including anything auto-detected Include a stub for that to autodetect PG version (even if it doesn't work just yet) pgtune-0.9.3/pg_settings-8.4-32000066400000000000000000001000551127216636700160430ustar00rootroot00000000000000add_missing_from off \N Version and Platform Compatibility / Previous PostgreSQL Versions Automatically adds missing table references to FROM clauses. \N user bool \N \N \N off allow_system_table_mods off \N Developer Options Allows modifications of the structure of system tables. \N postmaster bool \N \N \N off archive_command (disabled) \N Write-Ahead Log / Settings Sets the shell command that will be called to archive a WAL file. \N sighup string \N \N \N archive_mode off \N Write-Ahead Log / Settings Allows archiving of WAL files using archive_command. \N postmaster bool \N \N \N off archive_timeout 0 s Write-Ahead Log / Settings Forces a switch to the next xlog file if a new file has not been started within N seconds. \N sighup integer 0 2147483647 \N 0 array_nulls on \N Version and Platform Compatibility / Previous PostgreSQL Versions Enable input of NULL elements in arrays. When turned on, unquoted NULL in an array input value means a null value; otherwise it is taken literally. user bool \N \N \N on authentication_timeout 60 s Connections and Authentication / Security and Authentication Sets the maximum allowed time to complete client authentication. \N sighup integer 1 600 \N 60 autovacuum on \N Autovacuum Starts the autovacuum subprocess. \N sighup bool \N \N \N on autovacuum_analyze_scale_factor 0.1 \N Autovacuum Number of tuple inserts, updates or deletes prior to analyze as a fraction of reltuples. \N sighup real 0 100 \N 0.1 autovacuum_analyze_threshold 50 Autovacuum Minimum number of tuple inserts, updates or deletes prior to analyze. \N sighup integer 0 2147483647 \N 50 autovacuum_freeze_max_age 200000000 Autovacuum Age at which to autovacuum a table to prevent transaction ID wraparound. \N postmaster integer 100000000 2000000000 \N 200000000 autovacuum_max_workers 3 Autovacuum Sets the maximum number of simultaneously running autovacuum worker processes. \N postmaster integer 1 536870911 \N 3 autovacuum_naptime 60 s Autovacuum Time to sleep between autovacuum runs. \N sighup integer 1 2147483 \N 60 autovacuum_vacuum_cost_delay 20 ms Autovacuum Vacuum cost delay in milliseconds, for autovacuum. \N sighup integer -1 1000 \N 20 autovacuum_vacuum_cost_limit -1 Autovacuum Vacuum cost amount available before napping, for autovacuum. \N sighup integer -1 10000 \N -1 autovacuum_vacuum_scale_factor 0.2 \N Autovacuum Number of tuple updates or deletes prior to vacuum as a fraction of reltuples. \N sighup real 0 100 \N 0.2 autovacuum_vacuum_threshold 50 Autovacuum Minimum number of tuple updates or deletes prior to vacuum. \N sighup integer 0 2147483647 \N 50 backslash_quote safe_encoding \N Version and Platform Compatibility / Previous PostgreSQL Versions Sets whether "\\'" is allowed in string literals. \N user enum \N \N {safe_encoding,on,off} safe_encoding bgwriter_delay 200 ms Resource Usage Background writer sleep time between rounds. \N sighup integer 10 10000 \N 200 bgwriter_lru_maxpages 100 Resource Usage Background writer maximum number of LRU pages to flush per round. \N sighup integer 0 1000 \N 100 bgwriter_lru_multiplier 2 \N Resource Usage Multiple of the average buffer usage to free per round. \N sighup real 0 10 \N 2 block_size 8192 Preset Options Shows the size of a disk block. \N internal integer 8192 8192 \N 8192 bonjour_name \N Connections and Authentication / Connection Settings Sets the Bonjour broadcast service name. \N postmaster string \N \N \N check_function_bodies on \N Client Connection Defaults / Statement Behavior Check function bodies during CREATE FUNCTION. \N user bool \N \N \N on checkpoint_completion_target 0.5 \N Write-Ahead Log / Checkpoints Time spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval. \N sighup real 0 1 \N 0.5 checkpoint_segments 3 Write-Ahead Log / Checkpoints Sets the maximum distance in log segments between automatic WAL checkpoints. \N sighup integer 1 2147483647 \N 3 checkpoint_timeout 300 s Write-Ahead Log / Checkpoints Sets the maximum time between automatic WAL checkpoints. \N sighup integer 30 3600 \N 300 checkpoint_warning 30 s Write-Ahead Log / Checkpoints Enables warnings if checkpoint segments are filled more frequently than this. Write a message to the server log if checkpoints caused by the filling of checkpoint segment files happens more frequently than this number of seconds. Zero turns off the warning. sighup integer 0 2147483647 \N 30 client_encoding UTF8 \N Client Connection Defaults / Locale and Formatting Sets the client's character set encoding. \N user string \N \N \N SQL_ASCII client_min_messages notice \N Reporting and Logging / When to Log Sets the message levels that are sent to the client. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. user enum \N \N {debug5,debug4,debug3,debug2,debug1,log,notice,warning,error} notice commit_delay 0 Write-Ahead Log / Settings Sets the delay in microseconds between transaction commit and flushing WAL to disk. \N user integer 0 100000 \N 0 commit_siblings 5 Write-Ahead Log / Settings Sets the minimum concurrent open transactions before performing commit_delay. \N user integer 1 1000 \N 5 constraint_exclusion off \N Query Tuning / Other Planner Options Enables the planner to use constraints to optimize queries. Child table scans will be skipped if their constraints guarantee that no rows match the query. user bool \N \N \N off cpu_index_tuple_cost 0.005 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of processing each index entry during an index scan. \N user real 0 1.79769e+308 \N 0.005 cpu_operator_cost 0.0025 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of processing each operator or function call. \N user real 0 1.79769e+308 \N 0.0025 cpu_tuple_cost 0.01 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of processing each tuple (row). \N user real 0 1.79769e+308 \N 0.01 cursor_tuple_fraction 0.1 \N Query Tuning / Other Planner Options Sets the planner's estimate of the fraction of a cursor's rows that will be retrieved. \N user real 0 1 \N 0.1 custom_variable_classes \N Customized Options Sets the list of known custom variable classes. \N sighup string \N \N \N \N DateStyle ISO, MDY \N Client Connection Defaults / Locale and Formatting Sets the display format for date and time values. Also controls interpretation of ambiguous date inputs. user string \N \N \N ISO, MDY db_user_namespace off \N Connections and Authentication / Security and Authentication Enables per-database user names. \N sighup bool \N \N \N off deadlock_timeout 1000 ms Lock Management Sets the time to wait on a lock before checking for deadlock. \N sighup integer 1 2147483 \N 1000 debug_assertions on \N Developer Options Turns on various assertion checks. This is a debugging aid. user bool \N \N \N on debug_pretty_print on \N Reporting and Logging / What to Log Indents parse and plan tree displays. \N user bool \N \N \N on debug_print_parse off \N Reporting and Logging / What to Log Logs each query's parse tree. \N user bool \N \N \N off debug_print_plan off \N Reporting and Logging / What to Log Logs each query's execution plan. \N user bool \N \N \N off debug_print_rewritten off \N Reporting and Logging / What to Log Logs each query's rewritten parse tree. \N user bool \N \N \N off default_statistics_target 10 Query Tuning / Other Planner Options Sets the default statistics target. This applies to table columns that have not had a column-specific target set via ALTER TABLE SET STATISTICS. user integer 1 1000 \N 10 default_tablespace \N Client Connection Defaults / Statement Behavior Sets the default tablespace to create tables and indexes in. An empty string selects the database's default tablespace. user string \N \N \N default_text_search_config pg_catalog.english \N Client Connection Defaults / Locale and Formatting Sets default text search configuration. \N user string \N \N \N pg_catalog.simple default_transaction_isolation read committed \N Client Connection Defaults / Statement Behavior Sets the transaction isolation level of each new transaction. \N user enum \N \N {serializable,"repeatable read","read committed","read uncommitted"} read committed default_transaction_read_only off \N Client Connection Defaults / Statement Behavior Sets the default read-only status of new transactions. \N user bool \N \N \N off default_with_oids off \N Version and Platform Compatibility / Previous PostgreSQL Versions Create new tables with OIDs by default. \N user bool \N \N \N off dynamic_library_path $libdir \N Client Connection Defaults / Other Defaults Sets the path for dynamically loadable modules. If a dynamically loadable module needs to be opened and the specified name does not have a directory component (i.e., the name does not contain a slash), the system will search this path for the specified file. superuser string \N \N \N $libdir effective_cache_size 16384 8kB Query Tuning / Planner Cost Constants Sets the planner's assumption about the size of the disk cache. That is, the portion of the kernel's disk cache that will be used for PostgreSQL data files. This is measured in disk pages, which are normally 8 kB each. user integer 1 2147483647 \N 16384 enable_bitmapscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of bitmap-scan plans. \N user bool \N \N \N on enable_hashagg on \N Query Tuning / Planner Method Configuration Enables the planner's use of hashed aggregation plans. \N user bool \N \N \N on enable_hashjoin on \N Query Tuning / Planner Method Configuration Enables the planner's use of hash join plans. \N user bool \N \N \N on enable_indexscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of index-scan plans. \N user bool \N \N \N on enable_mergejoin on \N Query Tuning / Planner Method Configuration Enables the planner's use of merge join plans. \N user bool \N \N \N on enable_nestloop on \N Query Tuning / Planner Method Configuration Enables the planner's use of nested-loop join plans. \N user bool \N \N \N on enable_seqscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of sequential-scan plans. \N user bool \N \N \N on enable_sort on \N Query Tuning / Planner Method Configuration Enables the planner's use of explicit sort steps. \N user bool \N \N \N on enable_tidscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of TID scan plans. \N user bool \N \N \N on escape_string_warning on \N Version and Platform Compatibility / Previous PostgreSQL Versions Warn about backslash escapes in ordinary string literals. \N user bool \N \N \N on external_pid_file \N File Locations Writes the postmaster PID to the specified file. \N postmaster string \N \N \N \N extra_float_digits 0 Client Connection Defaults / Locale and Formatting Sets the number of digits displayed for floating-point values. This affects real, double precision, and geometric data types. The parameter value is added to the standard number of digits (FLT_DIG or DBL_DIG as appropriate). user integer -15 2 \N 0 from_collapse_limit 8 Query Tuning / Other Planner Options Sets the FROM-list size beyond which subqueries are not collapsed. The planner will merge subqueries into upper queries if the resulting FROM list would have no more than this many items. user integer 1 2147483647 \N 8 fsync on \N Write-Ahead Log / Settings Forces synchronization of updates to disk. The server will use the fsync() system call in several places to make sure that updates are physically written to disk. This insures that a database cluster will recover to a consistent state after an operating system or hardware crash. sighup bool \N \N \N on full_page_writes on \N Write-Ahead Log / Settings Writes full pages to WAL when first modified after a checkpoint. A page write in process during an operating system crash might be only partially written to disk. During recovery, the row changes stored in WAL are not enough to recover. This option writes pages when first modified after a checkpoint to WAL so full recovery is possible. sighup bool \N \N \N on geqo on \N Query Tuning / Genetic Query Optimizer Enables genetic query optimization. This algorithm attempts to do planning without exhaustive searching. user bool \N \N \N on geqo_effort 5 Query Tuning / Genetic Query Optimizer GEQO: effort is used to set the default for other GEQO parameters. \N user integer 1 10 \N 5 geqo_generations 0 Query Tuning / Genetic Query Optimizer GEQO: number of iterations of the algorithm. Zero selects a suitable default value. user integer 0 2147483647 \N 0 geqo_pool_size 0 Query Tuning / Genetic Query Optimizer GEQO: number of individuals in the population. Zero selects a suitable default value. user integer 0 2147483647 \N 0 geqo_selection_bias 2 \N Query Tuning / Genetic Query Optimizer GEQO: selective pressure within the population. \N user real 1.5 2 \N 2 geqo_threshold 12 Query Tuning / Genetic Query Optimizer Sets the threshold of FROM items beyond which GEQO is used. \N user integer 2 2147483647 \N 12 gin_fuzzy_search_limit 0 Client Connection Defaults / Other Defaults Sets the maximum allowed result for exact search by GIN. \N user integer 0 2147483647 \N 0 ignore_system_indexes off \N Developer Options Disables reading from system indexes. It does not prevent updating the indexes, so it is safe to use. The worst consequence is slowness. backend bool \N \N \N off integer_datetimes on \N Preset Options Datetimes are integer based. \N internal bool \N \N \N on IntervalStyle postgres \N Client Connection Defaults / Locale and Formatting Sets the display format for interval values. \N user enum \N \N {postgres,postgres_verbose,sql_standard,iso_8601} postgres join_collapse_limit 8 Query Tuning / Other Planner Options Sets the FROM-list size beyond which JOIN constructs are not flattened. The planner will flatten explicit JOIN constructs into lists of FROM items whenever a list of no more than this many items would result. user integer 1 2147483647 \N 8 krb_caseins_users off \N Connections and Authentication / Security and Authentication Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive. \N postmaster bool \N \N \N off krb_realm \N Connections and Authentication / Security and Authentication Sets realm to match Kerberos and GSSAPI users against. \N postmaster string \N \N \N \N krb_server_hostname \N Connections and Authentication / Security and Authentication Sets the hostname of the Kerberos server. \N postmaster string \N \N \N \N krb_server_keyfile \N Connections and Authentication / Security and Authentication Sets the location of the Kerberos server key file. \N postmaster string \N \N \N krb_srvname postgres \N Connections and Authentication / Security and Authentication Sets the name of the Kerberos service. \N postmaster string \N \N \N postgres lc_messages en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the language in which messages are displayed. \N superuser string \N \N \N lc_monetary en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the locale for formatting monetary amounts. \N user string \N \N \N C lc_numeric en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the locale for formatting numbers. \N user string \N \N \N C lc_time en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the locale for formatting date and time values. \N user string \N \N \N C listen_addresses localhost \N Connections and Authentication / Connection Settings Sets the host name or IP address(es) to listen to. \N postmaster string \N \N \N localhost local_preload_libraries \N Client Connection Defaults / Other Defaults Lists shared libraries to preload into each backend. \N backend string \N \N \N log_autovacuum_min_duration -1 ms Reporting and Logging / What to Log Sets the minimum execution time above which autovacuum actions will be logged. Zero prints all actions. -1 turns autovacuum logging off. sighup integer -1 2147483 \N -1 log_checkpoints off \N Reporting and Logging / What to Log Logs each checkpoint. \N sighup bool \N \N \N off log_connections off \N Reporting and Logging / What to Log Logs each successful connection. \N backend bool \N \N \N off log_destination stderr \N Reporting and Logging / Where to Log Sets the destination for server log output. Valid values are combinations of "stderr", "syslog", "csvlog", and "eventlog", depending on the platform. sighup string \N \N \N stderr log_directory pg_log \N Reporting and Logging / Where to Log Sets the destination directory for log files. Can be specified as relative to the data directory or as absolute path. sighup string \N \N \N pg_log log_disconnections off \N Reporting and Logging / What to Log Logs end of a session, including duration. \N backend bool \N \N \N off log_duration off \N Reporting and Logging / What to Log Logs the duration of each completed SQL statement. \N superuser bool \N \N \N off log_error_verbosity default \N Reporting and Logging / When to Log Sets the verbosity of logged messages. \N superuser enum \N \N {terse,default,verbose} default log_executor_stats off \N Statistics / Monitoring Writes executor performance statistics to the server log. \N superuser bool \N \N \N off log_filename postgresql-%Y-%m-%d_%H%M%S.log \N Reporting and Logging / Where to Log Sets the file name pattern for log files. \N sighup string \N \N \N postgresql-%Y-%m-%d_%H%M%S.log log_hostname off \N Reporting and Logging / What to Log Logs the host name in the connection logs. By default, connection logs only show the IP address of the connecting host. If you want them to show the host name you can turn this on, but depending on your host name resolution setup it might impose a non-negligible performance penalty. sighup bool \N \N \N off log_line_prefix \N Reporting and Logging / What to Log Controls information prefixed to each log line. If blank, no prefix is used. sighup string \N \N \N log_lock_waits off \N Reporting and Logging / What to Log Logs long lock waits. \N superuser bool \N \N \N off log_min_duration_statement -1 ms Reporting and Logging / When to Log Sets the minimum execution time above which statements will be logged. Zero prints all queries. -1 turns this feature off. superuser integer -1 2147483 \N -1 log_min_error_statement error \N Reporting and Logging / When to Log Causes all statements generating error at or above this level to be logged. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. superuser enum \N \N {debug5,debug4,debug3,debug2,debug1,info,notice,warning,error,log,fatal,panic} error log_min_messages warning \N Reporting and Logging / When to Log Sets the message levels that are logged. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. superuser enum \N \N {debug5,debug4,debug3,debug2,debug1,info,notice,warning,error,log,fatal,panic} warning log_parser_stats off \N Statistics / Monitoring Writes parser performance statistics to the server log. \N superuser bool \N \N \N off log_planner_stats off \N Statistics / Monitoring Writes planner performance statistics to the server log. \N superuser bool \N \N \N off log_rotation_age 1440 min Reporting and Logging / Where to Log Automatic log file rotation will occur after N minutes. \N sighup integer 0 35791394 \N 1440 log_rotation_size 10240 kB Reporting and Logging / Where to Log Automatic log file rotation will occur after N kilobytes. \N sighup integer 0 2097151 \N 10240 log_statement none \N Reporting and Logging / What to Log Sets the type of statements logged. \N superuser enum \N \N {none,ddl,mod,all} none log_statement_stats off \N Statistics / Monitoring Writes cumulative performance statistics to the server log. \N superuser bool \N \N \N off log_temp_files -1 kB Reporting and Logging / What to Log Log the use of temporary files larger than this number of kilobytes. Zero logs all files. The default is -1 (turning this feature off). superuser integer -1 2147483647 \N -1 log_timezone US/Eastern \N Reporting and Logging / What to Log Sets the time zone to use in log messages. \N sighup string \N \N \N UNKNOWN log_truncate_on_rotation off \N Reporting and Logging / Where to Log Truncate existing log files of same name during log rotation. \N sighup bool \N \N \N off logging_collector off \N Reporting and Logging / Where to Log Start a subprocess to capture stderr output and/or csvlogs into log files. \N postmaster bool \N \N \N off maintenance_work_mem 16384 kB Resource Usage / Memory Sets the maximum memory to be used for maintenance operations. This includes operations such as VACUUM and CREATE INDEX. user integer 1024 2097151 \N 16384 max_connections 100 Connections and Authentication / Connection Settings Sets the maximum number of concurrent connections. \N postmaster integer 1 536870911 \N 100 max_files_per_process 1000 Resource Usage / Kernel Resources Sets the maximum number of simultaneously open files for each server process. \N postmaster integer 25 2147483647 \N 1000 max_function_args 100 Preset Options Shows the maximum number of function arguments. \N internal integer 100 100 \N 100 max_identifier_length 63 Preset Options Shows the maximum identifier length. \N internal integer 63 63 \N 63 max_index_keys 32 Preset Options Shows the maximum number of index keys. \N internal integer 32 32 \N 32 max_locks_per_transaction 64 Lock Management Sets the maximum number of locks per transaction. The shared lock table is sized on the assumption that at most max_locks_per_transaction * max_connections distinct objects will need to be locked at any one time. postmaster integer 10 2147483647 \N 64 max_prepared_transactions 5 Resource Usage Sets the maximum number of simultaneously prepared transactions. \N postmaster integer 0 2147483647 \N 5 max_stack_depth 2048 kB Resource Usage / Memory Sets the maximum stack depth, in kilobytes. \N superuser integer 100 2097151 \N 100 password_encryption on \N Connections and Authentication / Security and Authentication Encrypt passwords. When a password is specified in CREATE USER or ALTER USER without writing either ENCRYPTED or UNENCRYPTED, this parameter determines whether the password is to be encrypted. user bool \N \N \N on port 5432 Connections and Authentication / Connection Settings Sets the TCP port the server listens on. \N postmaster integer 1 65535 \N 5432 post_auth_delay 0 s Developer Options Waits N seconds on connection startup after authentication. This allows attaching a debugger to the process. backend integer 0 2147483647 \N 0 pre_auth_delay 0 s Developer Options Waits N seconds on connection startup before authentication. This allows attaching a debugger to the process. sighup integer 0 60 \N 0 random_page_cost 4 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of a nonsequentially fetched disk page. \N user real 0 1.79769e+308 \N 4 regex_flavor advanced \N Version and Platform Compatibility / Previous PostgreSQL Versions Sets the regular expression "flavor". \N user enum \N \N {advanced,extended,basic} advanced search_path "$user",public \N Client Connection Defaults / Statement Behavior Sets the schema search order for names that are not schema-qualified. \N user string \N \N \N "$user",public segment_size 131072 8kB Preset Options Shows the number of pages per disk file. \N internal integer 131072 131072 \N 131072 seq_page_cost 1 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of a sequentially fetched disk page. \N user real 0 1.79769e+308 \N 1 server_version 8.4devel \N Preset Options Shows the server version. \N internal string \N \N \N 8.4devel server_version_num 80400 Preset Options Shows the server version as an integer. \N internal integer 80400 80400 \N 80400 session_replication_role origin \N Client Connection Defaults / Statement Behavior Sets the session's behavior for triggers and rewrite rules. \N superuser enum \N \N {origin,replica,local} origin shared_buffers 4096 8kB Resource Usage / Memory Sets the number of shared memory buffers used by the server. \N postmaster integer 16 1073741823 \N 1024 shared_preload_libraries \N Resource Usage / Kernel Resources Lists shared libraries to preload into server. \N postmaster string \N \N \N silent_mode off \N Reporting and Logging / When to Log Runs the server silently. If this parameter is set, the server will automatically run in the background and any controlling terminals are dissociated. postmaster bool \N \N \N off sql_inheritance on \N Version and Platform Compatibility / Previous PostgreSQL Versions Causes subtables to be included by default in various commands. \N user bool \N \N \N on ssl off \N Connections and Authentication / Security and Authentication Enables SSL connections. \N postmaster bool \N \N \N off standard_conforming_strings off \N Version and Platform Compatibility / Previous PostgreSQL Versions Causes '...' strings to treat backslashes literally. \N user bool \N \N \N off statement_timeout 0 ms Client Connection Defaults / Statement Behavior Sets the maximum allowed duration of any statement. A value of 0 turns off the timeout. user integer 0 2147483647 \N 0 stats_temp_directory pg_stat_tmp \N Statistics / Query and Index Statistics Collector Writes temporary statistics files to the specified directory. \N sighup string \N \N \N pg_stat_tmp superuser_reserved_connections 3 Connections and Authentication / Connection Settings Sets the number of connection slots reserved for superusers. \N postmaster integer 0 536870911 \N 3 synchronize_seqscans on \N Version and Platform Compatibility / Previous PostgreSQL Versions Enable synchronized sequential scans. \N user bool \N \N \N on synchronous_commit on \N Write-Ahead Log / Settings Sets immediate fsync at commit. \N user bool \N \N \N on syslog_facility local0 \N Reporting and Logging / Where to Log Sets the syslog "facility" to be used when syslog enabled. \N sighup enum \N \N {local0,local1,local2,local3,local4,local5,local6,local7} local0 syslog_ident postgres \N Reporting and Logging / Where to Log Sets the program name used to identify PostgreSQL messages in syslog. \N sighup string \N \N \N postgres tcp_keepalives_count 0 Client Connection Defaults / Other Defaults Maximum number of TCP keepalive retransmits. This controls the number of consecutive keepalive retransmits that can be lost before a connection is considered dead. A value of 0 uses the system default. user integer 0 2147483647 \N 0 tcp_keepalives_idle 0 s Client Connection Defaults / Other Defaults Time between issuing TCP keepalives. A value of 0 uses the system default. user integer 0 2147483647 \N 0 tcp_keepalives_interval 0 s Client Connection Defaults / Other Defaults Time between TCP keepalive retransmits. A value of 0 uses the system default. user integer 0 2147483647 \N 0 temp_buffers 1024 8kB Resource Usage / Memory Sets the maximum number of temporary buffers used by each session. \N user integer 100 1073741823 \N 1024 temp_tablespaces \N Client Connection Defaults / Statement Behavior Sets the tablespace(s) to use for temporary tables and sort files. \N user string \N \N \N TimeZone US/Eastern \N Client Connection Defaults / Locale and Formatting Sets the time zone for displaying and interpreting time stamps. \N user string \N \N \N UNKNOWN timezone_abbreviations Default \N Client Connection Defaults / Locale and Formatting Selects a file of time zone abbreviations. \N user string \N \N \N UNKNOWN trace_notify off \N Developer Options Generates debugging output for LISTEN and NOTIFY. \N user bool \N \N \N off trace_sort off \N Developer Options Emit information about resource usage in sorting. \N user bool \N \N \N off track_activities on \N Statistics / Query and Index Statistics Collector Collects information about executing commands. Enables the collection of information on the currently executing command of each session, along with the time at which that command began execution. superuser bool \N \N \N on track_activity_query_size 1024 Resource Usage / Memory Sets the size reserved for pg_stat_activity.current_query, in bytes. \N postmaster integer 100 102400 \N 1024 track_counts on \N Statistics / Query and Index Statistics Collector Collects statistics on database activity. \N superuser bool \N \N \N on track_functions none \N Statistics / Query and Index Statistics Collector Collects function-level statistics on database activity. \N superuser enum \N \N {none,pl,all} none transform_null_equals off \N Version and Platform Compatibility / Other Platforms and Clients Treats "expr=NULL" as "expr IS NULL". When turned on, expressions of the form expr = NULL (or NULL = expr) are treated as expr IS NULL, that is, they return true if expr evaluates to the null value, and false otherwise. The correct behavior of expr = NULL is to always return null (unknown). user bool \N \N \N off unix_socket_directory \N Connections and Authentication / Connection Settings Sets the directory where the Unix-domain socket will be created. \N postmaster string \N \N \N unix_socket_group \N Connections and Authentication / Connection Settings Sets the owning group of the Unix-domain socket. The owning user of the socket is always the user that starts the server. postmaster string \N \N \N unix_socket_permissions 511 Connections and Authentication / Connection Settings Sets the access permissions of the Unix-domain socket. Unix-domain sockets use the usual Unix file system permission set. The parameter value is expected to be a numeric mode specification in the form accepted by the chmod and umask system calls. (To use the customary octal format the number must start with a 0 (zero).) postmaster integer 0 511 \N 511 update_process_title on \N Statistics / Query and Index Statistics Collector Updates the process title to show the active SQL command. Enables updating of the process title every time a new SQL command is received by the server. superuser bool \N \N \N on vacuum_cost_delay 0 ms Resource Usage Vacuum cost delay in milliseconds. \N user integer 0 1000 \N 0 vacuum_cost_limit 200 Resource Usage Vacuum cost amount available before napping. \N user integer 1 10000 \N 200 vacuum_cost_page_dirty 20 Resource Usage Vacuum cost for a page dirtied by vacuum. \N user integer 0 10000 \N 20 vacuum_cost_page_hit 1 Resource Usage Vacuum cost for a page found in the buffer cache. \N user integer 0 10000 \N 1 vacuum_cost_page_miss 10 Resource Usage Vacuum cost for a page not found in the buffer cache. \N user integer 0 10000 \N 10 vacuum_freeze_min_age 100000000 Client Connection Defaults / Statement Behavior Minimum age at which VACUUM should freeze a table row. \N user integer 0 1000000000 \N 100000000 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_segment_size 2048 8kB Preset Options Shows the number of pages per write ahead log segment. \N internal integer 2048 2048 \N 2048 wal_sync_method fdatasync \N Write-Ahead Log / Settings Selects the method used for forcing WAL updates to disk. \N sighup enum \N \N {fsync,fdatasync,open_sync} fdatasync wal_writer_delay 200 ms Write-Ahead Log / Settings WAL writer sleep time between WAL flushes. \N sighup integer 1 10000 \N 200 work_mem 1024 kB Resource Usage / Memory Sets the maximum memory to be used for query workspaces. This much memory can be used by each internal sort operation and hash table before switching to temporary disk files. user integer 64 2097151 \N 1024 xmlbinary base64 \N Client Connection Defaults / Statement Behavior Sets how binary values are to be encoded in XML. \N user enum \N \N {base64,hex} base64 xmloption content \N Client Connection Defaults / Statement Behavior Sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments. \N user enum \N \N {content,document} content zero_damaged_pages off \N Developer Options Continues processing past damaged page headers. Detection of a damaged page header normally causes PostgreSQL to report an error, aborting the current transaction. Setting zero_damaged_pages to true causes the system to instead report a warning, zero out the damaged page, and continue processing. This behavior will destroy data, namely all the rows on the damaged page. superuser bool \N \N \N off pgtune-0.9.3/pg_settings-8.4-64000066400000000000000000001000661127216636700160520ustar00rootroot00000000000000add_missing_from off \N Version and Platform Compatibility / Previous PostgreSQL Versions Automatically adds missing table references to FROM clauses. \N user bool \N \N \N off allow_system_table_mods off \N Developer Options Allows modifications of the structure of system tables. \N postmaster bool \N \N \N off archive_command (disabled) \N Write-Ahead Log / Settings Sets the shell command that will be called to archive a WAL file. \N sighup string \N \N \N archive_mode off \N Write-Ahead Log / Settings Allows archiving of WAL files using archive_command. \N postmaster bool \N \N \N off archive_timeout 0 s Write-Ahead Log / Settings Forces a switch to the next xlog file if a new file has not been started within N seconds. \N sighup integer 0 2147483647 \N 0 array_nulls on \N Version and Platform Compatibility / Previous PostgreSQL Versions Enable input of NULL elements in arrays. When turned on, unquoted NULL in an array input value means a null value; otherwise it is taken literally. user bool \N \N \N on authentication_timeout 60 s Connections and Authentication / Security and Authentication Sets the maximum allowed time to complete client authentication. \N sighup integer 1 600 \N 60 autovacuum on \N Autovacuum Starts the autovacuum subprocess. \N sighup bool \N \N \N on autovacuum_analyze_scale_factor 0.1 \N Autovacuum Number of tuple inserts, updates or deletes prior to analyze as a fraction of reltuples. \N sighup real 0 100 \N 0.1 autovacuum_analyze_threshold 50 Autovacuum Minimum number of tuple inserts, updates or deletes prior to analyze. \N sighup integer 0 2147483647 \N 50 autovacuum_freeze_max_age 200000000 Autovacuum Age at which to autovacuum a table to prevent transaction ID wraparound. \N postmaster integer 100000000 2000000000 \N 200000000 autovacuum_max_workers 3 Autovacuum Sets the maximum number of simultaneously running autovacuum worker processes. \N postmaster integer 1 536870911 \N 3 autovacuum_naptime 60 s Autovacuum Time to sleep between autovacuum runs. \N sighup integer 1 2147483 \N 60 autovacuum_vacuum_cost_delay 20 ms Autovacuum Vacuum cost delay in milliseconds, for autovacuum. \N sighup integer -1 1000 \N 20 autovacuum_vacuum_cost_limit -1 Autovacuum Vacuum cost amount available before napping, for autovacuum. \N sighup integer -1 10000 \N -1 autovacuum_vacuum_scale_factor 0.2 \N Autovacuum Number of tuple updates or deletes prior to vacuum as a fraction of reltuples. \N sighup real 0 100 \N 0.2 autovacuum_vacuum_threshold 50 Autovacuum Minimum number of tuple updates or deletes prior to vacuum. \N sighup integer 0 2147483647 \N 50 backslash_quote safe_encoding \N Version and Platform Compatibility / Previous PostgreSQL Versions Sets whether "\\'" is allowed in string literals. \N user enum \N \N {safe_encoding,on,off} safe_encoding bgwriter_delay 200 ms Resource Usage Background writer sleep time between rounds. \N sighup integer 10 10000 \N 200 bgwriter_lru_maxpages 100 Resource Usage Background writer maximum number of LRU pages to flush per round. \N sighup integer 0 1000 \N 100 bgwriter_lru_multiplier 2 \N Resource Usage Multiple of the average buffer usage to free per round. \N sighup real 0 10 \N 2 block_size 8192 Preset Options Shows the size of a disk block. \N internal integer 8192 8192 \N 8192 bonjour_name \N Connections and Authentication / Connection Settings Sets the Bonjour broadcast service name. \N postmaster string \N \N \N check_function_bodies on \N Client Connection Defaults / Statement Behavior Check function bodies during CREATE FUNCTION. \N user bool \N \N \N on checkpoint_completion_target 0.5 \N Write-Ahead Log / Checkpoints Time spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval. \N sighup real 0 1 \N 0.5 checkpoint_segments 3 Write-Ahead Log / Checkpoints Sets the maximum distance in log segments between automatic WAL checkpoints. \N sighup integer 1 2147483647 \N 3 checkpoint_timeout 300 s Write-Ahead Log / Checkpoints Sets the maximum time between automatic WAL checkpoints. \N sighup integer 30 3600 \N 300 checkpoint_warning 30 s Write-Ahead Log / Checkpoints Enables warnings if checkpoint segments are filled more frequently than this. Write a message to the server log if checkpoints caused by the filling of checkpoint segment files happens more frequently than this number of seconds. Zero turns off the warning. sighup integer 0 2147483647 \N 30 client_encoding UTF8 \N Client Connection Defaults / Locale and Formatting Sets the client's character set encoding. \N user string \N \N \N SQL_ASCII client_min_messages notice \N Reporting and Logging / When to Log Sets the message levels that are sent to the client. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. user enum \N \N {debug5,debug4,debug3,debug2,debug1,log,notice,warning,error} notice commit_delay 0 Write-Ahead Log / Settings Sets the delay in microseconds between transaction commit and flushing WAL to disk. \N user integer 0 100000 \N 0 commit_siblings 5 Write-Ahead Log / Settings Sets the minimum concurrent open transactions before performing commit_delay. \N user integer 1 1000 \N 5 constraint_exclusion off \N Query Tuning / Other Planner Options Enables the planner to use constraints to optimize queries. Child table scans will be skipped if their constraints guarantee that no rows match the query. user bool \N \N \N off cpu_index_tuple_cost 0.005 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of processing each index entry during an index scan. \N user real 0 1.79769e+308 \N 0.005 cpu_operator_cost 0.0025 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of processing each operator or function call. \N user real 0 1.79769e+308 \N 0.0025 cpu_tuple_cost 0.01 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of processing each tuple (row). \N user real 0 1.79769e+308 \N 0.01 cursor_tuple_fraction 0.1 \N Query Tuning / Other Planner Options Sets the planner's estimate of the fraction of a cursor's rows that will be retrieved. \N user real 0 1 \N 0.1 custom_variable_classes \N Customized Options Sets the list of known custom variable classes. \N sighup string \N \N \N \N DateStyle ISO, MDY \N Client Connection Defaults / Locale and Formatting Sets the display format for date and time values. Also controls interpretation of ambiguous date inputs. user string \N \N \N ISO, MDY db_user_namespace off \N Connections and Authentication / Security and Authentication Enables per-database user names. \N sighup bool \N \N \N off deadlock_timeout 1000 ms Lock Management Sets the time to wait on a lock before checking for deadlock. \N sighup integer 1 2147483 \N 1000 debug_assertions on \N Developer Options Turns on various assertion checks. This is a debugging aid. user bool \N \N \N on debug_pretty_print on \N Reporting and Logging / What to Log Indents parse and plan tree displays. \N user bool \N \N \N on debug_print_parse off \N Reporting and Logging / What to Log Logs each query's parse tree. \N user bool \N \N \N off debug_print_plan off \N Reporting and Logging / What to Log Logs each query's execution plan. \N user bool \N \N \N off debug_print_rewritten off \N Reporting and Logging / What to Log Logs each query's rewritten parse tree. \N user bool \N \N \N off default_statistics_target 10 Query Tuning / Other Planner Options Sets the default statistics target. This applies to table columns that have not had a column-specific target set via ALTER TABLE SET STATISTICS. user integer 1 1000 \N 10 default_tablespace \N Client Connection Defaults / Statement Behavior Sets the default tablespace to create tables and indexes in. An empty string selects the database's default tablespace. user string \N \N \N default_text_search_config pg_catalog.english \N Client Connection Defaults / Locale and Formatting Sets default text search configuration. \N user string \N \N \N pg_catalog.simple default_transaction_isolation read committed \N Client Connection Defaults / Statement Behavior Sets the transaction isolation level of each new transaction. \N user enum \N \N {serializable,"repeatable read","read committed","read uncommitted"} read committed default_transaction_read_only off \N Client Connection Defaults / Statement Behavior Sets the default read-only status of new transactions. \N user bool \N \N \N off default_with_oids off \N Version and Platform Compatibility / Previous PostgreSQL Versions Create new tables with OIDs by default. \N user bool \N \N \N off dynamic_library_path $libdir \N Client Connection Defaults / Other Defaults Sets the path for dynamically loadable modules. If a dynamically loadable module needs to be opened and the specified name does not have a directory component (i.e., the name does not contain a slash), the system will search this path for the specified file. superuser string \N \N \N $libdir effective_cache_size 16384 8kB Query Tuning / Planner Cost Constants Sets the planner's assumption about the size of the disk cache. That is, the portion of the kernel's disk cache that will be used for PostgreSQL data files. This is measured in disk pages, which are normally 8 kB each. user integer 1 2147483647 \N 16384 enable_bitmapscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of bitmap-scan plans. \N user bool \N \N \N on enable_hashagg on \N Query Tuning / Planner Method Configuration Enables the planner's use of hashed aggregation plans. \N user bool \N \N \N on enable_hashjoin on \N Query Tuning / Planner Method Configuration Enables the planner's use of hash join plans. \N user bool \N \N \N on enable_indexscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of index-scan plans. \N user bool \N \N \N on enable_mergejoin on \N Query Tuning / Planner Method Configuration Enables the planner's use of merge join plans. \N user bool \N \N \N on enable_nestloop on \N Query Tuning / Planner Method Configuration Enables the planner's use of nested-loop join plans. \N user bool \N \N \N on enable_seqscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of sequential-scan plans. \N user bool \N \N \N on enable_sort on \N Query Tuning / Planner Method Configuration Enables the planner's use of explicit sort steps. \N user bool \N \N \N on enable_tidscan on \N Query Tuning / Planner Method Configuration Enables the planner's use of TID scan plans. \N user bool \N \N \N on escape_string_warning on \N Version and Platform Compatibility / Previous PostgreSQL Versions Warn about backslash escapes in ordinary string literals. \N user bool \N \N \N on external_pid_file \N File Locations Writes the postmaster PID to the specified file. \N postmaster string \N \N \N \N extra_float_digits 0 Client Connection Defaults / Locale and Formatting Sets the number of digits displayed for floating-point values. This affects real, double precision, and geometric data types. The parameter value is added to the standard number of digits (FLT_DIG or DBL_DIG as appropriate). user integer -15 2 \N 0 from_collapse_limit 8 Query Tuning / Other Planner Options Sets the FROM-list size beyond which subqueries are not collapsed. The planner will merge subqueries into upper queries if the resulting FROM list would have no more than this many items. user integer 1 2147483647 \N 8 fsync on \N Write-Ahead Log / Settings Forces synchronization of updates to disk. The server will use the fsync() system call in several places to make sure that updates are physically written to disk. This insures that a database cluster will recover to a consistent state after an operating system or hardware crash. sighup bool \N \N \N on full_page_writes on \N Write-Ahead Log / Settings Writes full pages to WAL when first modified after a checkpoint. A page write in process during an operating system crash might be only partially written to disk. During recovery, the row changes stored in WAL are not enough to recover. This option writes pages when first modified after a checkpoint to WAL so full recovery is possible. sighup bool \N \N \N on geqo on \N Query Tuning / Genetic Query Optimizer Enables genetic query optimization. This algorithm attempts to do planning without exhaustive searching. user bool \N \N \N on geqo_effort 5 Query Tuning / Genetic Query Optimizer GEQO: effort is used to set the default for other GEQO parameters. \N user integer 1 10 \N 5 geqo_generations 0 Query Tuning / Genetic Query Optimizer GEQO: number of iterations of the algorithm. Zero selects a suitable default value. user integer 0 2147483647 \N 0 geqo_pool_size 0 Query Tuning / Genetic Query Optimizer GEQO: number of individuals in the population. Zero selects a suitable default value. user integer 0 2147483647 \N 0 geqo_selection_bias 2 \N Query Tuning / Genetic Query Optimizer GEQO: selective pressure within the population. \N user real 1.5 2 \N 2 geqo_threshold 12 Query Tuning / Genetic Query Optimizer Sets the threshold of FROM items beyond which GEQO is used. \N user integer 2 2147483647 \N 12 gin_fuzzy_search_limit 0 Client Connection Defaults / Other Defaults Sets the maximum allowed result for exact search by GIN. \N user integer 0 2147483647 \N 0 ignore_system_indexes off \N Developer Options Disables reading from system indexes. It does not prevent updating the indexes, so it is safe to use. The worst consequence is slowness. backend bool \N \N \N off integer_datetimes on \N Preset Options Datetimes are integer based. \N internal bool \N \N \N on IntervalStyle postgres \N Client Connection Defaults / Locale and Formatting Sets the display format for interval values. \N user enum \N \N {postgres,postgres_verbose,sql_standard,iso_8601} postgres join_collapse_limit 8 Query Tuning / Other Planner Options Sets the FROM-list size beyond which JOIN constructs are not flattened. The planner will flatten explicit JOIN constructs into lists of FROM items whenever a list of no more than this many items would result. user integer 1 2147483647 \N 8 krb_caseins_users off \N Connections and Authentication / Security and Authentication Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive. \N postmaster bool \N \N \N off krb_realm \N Connections and Authentication / Security and Authentication Sets realm to match Kerberos and GSSAPI users against. \N postmaster string \N \N \N \N krb_server_hostname \N Connections and Authentication / Security and Authentication Sets the hostname of the Kerberos server. \N postmaster string \N \N \N \N krb_server_keyfile \N Connections and Authentication / Security and Authentication Sets the location of the Kerberos server key file. \N postmaster string \N \N \N krb_srvname postgres \N Connections and Authentication / Security and Authentication Sets the name of the Kerberos service. \N postmaster string \N \N \N postgres lc_messages en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the language in which messages are displayed. \N superuser string \N \N \N lc_monetary en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the locale for formatting monetary amounts. \N user string \N \N \N C lc_numeric en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the locale for formatting numbers. \N user string \N \N \N C lc_time en_US.UTF-8 \N Client Connection Defaults / Locale and Formatting Sets the locale for formatting date and time values. \N user string \N \N \N C listen_addresses localhost \N Connections and Authentication / Connection Settings Sets the host name or IP address(es) to listen to. \N postmaster string \N \N \N localhost local_preload_libraries \N Client Connection Defaults / Other Defaults Lists shared libraries to preload into each backend. \N backend string \N \N \N log_autovacuum_min_duration -1 ms Reporting and Logging / What to Log Sets the minimum execution time above which autovacuum actions will be logged. Zero prints all actions. -1 turns autovacuum logging off. sighup integer -1 2147483 \N -1 log_checkpoints off \N Reporting and Logging / What to Log Logs each checkpoint. \N sighup bool \N \N \N off log_connections off \N Reporting and Logging / What to Log Logs each successful connection. \N backend bool \N \N \N off log_destination stderr \N Reporting and Logging / Where to Log Sets the destination for server log output. Valid values are combinations of "stderr", "syslog", "csvlog", and "eventlog", depending on the platform. sighup string \N \N \N stderr log_directory pg_log \N Reporting and Logging / Where to Log Sets the destination directory for log files. Can be specified as relative to the data directory or as absolute path. sighup string \N \N \N pg_log log_disconnections off \N Reporting and Logging / What to Log Logs end of a session, including duration. \N backend bool \N \N \N off log_duration off \N Reporting and Logging / What to Log Logs the duration of each completed SQL statement. \N superuser bool \N \N \N off log_error_verbosity default \N Reporting and Logging / When to Log Sets the verbosity of logged messages. \N superuser enum \N \N {terse,default,verbose} default log_executor_stats off \N Statistics / Monitoring Writes executor performance statistics to the server log. \N superuser bool \N \N \N off log_filename postgresql-%Y-%m-%d_%H%M%S.log \N Reporting and Logging / Where to Log Sets the file name pattern for log files. \N sighup string \N \N \N postgresql-%Y-%m-%d_%H%M%S.log log_hostname off \N Reporting and Logging / What to Log Logs the host name in the connection logs. By default, connection logs only show the IP address of the connecting host. If you want them to show the host name you can turn this on, but depending on your host name resolution setup it might impose a non-negligible performance penalty. sighup bool \N \N \N off log_line_prefix \N Reporting and Logging / What to Log Controls information prefixed to each log line. If blank, no prefix is used. sighup string \N \N \N log_lock_waits off \N Reporting and Logging / What to Log Logs long lock waits. \N superuser bool \N \N \N off log_min_duration_statement -1 ms Reporting and Logging / When to Log Sets the minimum execution time above which statements will be logged. Zero prints all queries. -1 turns this feature off. superuser integer -1 2147483 \N -1 log_min_error_statement error \N Reporting and Logging / When to Log Causes all statements generating error at or above this level to be logged. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. superuser enum \N \N {debug5,debug4,debug3,debug2,debug1,info,notice,warning,error,log,fatal,panic} error log_min_messages warning \N Reporting and Logging / When to Log Sets the message levels that are logged. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. superuser enum \N \N {debug5,debug4,debug3,debug2,debug1,info,notice,warning,error,log,fatal,panic} warning log_parser_stats off \N Statistics / Monitoring Writes parser performance statistics to the server log. \N superuser bool \N \N \N off log_planner_stats off \N Statistics / Monitoring Writes planner performance statistics to the server log. \N superuser bool \N \N \N off log_rotation_age 1440 min Reporting and Logging / Where to Log Automatic log file rotation will occur after N minutes. \N sighup integer 0 35791394 \N 1440 log_rotation_size 10240 kB Reporting and Logging / Where to Log Automatic log file rotation will occur after N kilobytes. \N sighup integer 0 2097151 \N 10240 log_statement none \N Reporting and Logging / What to Log Sets the type of statements logged. \N superuser enum \N \N {none,ddl,mod,all} none log_statement_stats off \N Statistics / Monitoring Writes cumulative performance statistics to the server log. \N superuser bool \N \N \N off log_temp_files -1 kB Reporting and Logging / What to Log Log the use of temporary files larger than this number of kilobytes. Zero logs all files. The default is -1 (turning this feature off). superuser integer -1 2147483647 \N -1 log_timezone US/Eastern \N Reporting and Logging / What to Log Sets the time zone to use in log messages. \N sighup string \N \N \N UNKNOWN log_truncate_on_rotation off \N Reporting and Logging / Where to Log Truncate existing log files of same name during log rotation. \N sighup bool \N \N \N off logging_collector off \N Reporting and Logging / Where to Log Start a subprocess to capture stderr output and/or csvlogs into log files. \N postmaster bool \N \N \N off maintenance_work_mem 16384 kB Resource Usage / Memory Sets the maximum memory to be used for maintenance operations. This includes operations such as VACUUM and CREATE INDEX. user integer 1024 2147483647 \N 16384 max_connections 100 Connections and Authentication / Connection Settings Sets the maximum number of concurrent connections. \N postmaster integer 1 536870911 \N 100 max_files_per_process 1000 Resource Usage / Kernel Resources Sets the maximum number of simultaneously open files for each server process. \N postmaster integer 25 2147483647 \N 1000 max_function_args 100 Preset Options Shows the maximum number of function arguments. \N internal integer 100 100 \N 100 max_identifier_length 63 Preset Options Shows the maximum identifier length. \N internal integer 63 63 \N 63 max_index_keys 32 Preset Options Shows the maximum number of index keys. \N internal integer 32 32 \N 32 max_locks_per_transaction 64 Lock Management Sets the maximum number of locks per transaction. The shared lock table is sized on the assumption that at most max_locks_per_transaction * max_connections distinct objects will need to be locked at any one time. postmaster integer 10 2147483647 \N 64 max_prepared_transactions 5 Resource Usage Sets the maximum number of simultaneously prepared transactions. \N postmaster integer 0 2147483647 \N 5 max_stack_depth 2048 kB Resource Usage / Memory Sets the maximum stack depth, in kilobytes. \N superuser integer 100 2147483647 \N 100 password_encryption on \N Connections and Authentication / Security and Authentication Encrypt passwords. When a password is specified in CREATE USER or ALTER USER without writing either ENCRYPTED or UNENCRYPTED, this parameter determines whether the password is to be encrypted. user bool \N \N \N on port 5432 Connections and Authentication / Connection Settings Sets the TCP port the server listens on. \N postmaster integer 1 65535 \N 5432 post_auth_delay 0 s Developer Options Waits N seconds on connection startup after authentication. This allows attaching a debugger to the process. backend integer 0 2147483647 \N 0 pre_auth_delay 0 s Developer Options Waits N seconds on connection startup before authentication. This allows attaching a debugger to the process. sighup integer 0 60 \N 0 random_page_cost 4 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of a nonsequentially fetched disk page. \N user real 0 1.79769e+308 \N 4 regex_flavor advanced \N Version and Platform Compatibility / Previous PostgreSQL Versions Sets the regular expression "flavor". \N user enum \N \N {advanced,extended,basic} advanced search_path "$user",public \N Client Connection Defaults / Statement Behavior Sets the schema search order for names that are not schema-qualified. \N user string \N \N \N "$user",public segment_size 131072 8kB Preset Options Shows the number of pages per disk file. \N internal integer 131072 131072 \N 131072 seq_page_cost 1 \N Query Tuning / Planner Cost Constants Sets the planner's estimate of the cost of a sequentially fetched disk page. \N user real 0 1.79769e+308 \N 1 server_version 8.4devel \N Preset Options Shows the server version. \N internal string \N \N \N 8.4devel server_version_num 80400 Preset Options Shows the server version as an integer. \N internal integer 80400 80400 \N 80400 session_replication_role origin \N Client Connection Defaults / Statement Behavior Sets the session's behavior for triggers and rewrite rules. \N superuser enum \N \N {origin,replica,local} origin shared_buffers 4096 8kB Resource Usage / Memory Sets the number of shared memory buffers used by the server. \N postmaster integer 16 1073741823 \N 1024 shared_preload_libraries \N Resource Usage / Kernel Resources Lists shared libraries to preload into server. \N postmaster string \N \N \N silent_mode off \N Reporting and Logging / When to Log Runs the server silently. If this parameter is set, the server will automatically run in the background and any controlling terminals are dissociated. postmaster bool \N \N \N off sql_inheritance on \N Version and Platform Compatibility / Previous PostgreSQL Versions Causes subtables to be included by default in various commands. \N user bool \N \N \N on ssl off \N Connections and Authentication / Security and Authentication Enables SSL connections. \N postmaster bool \N \N \N off standard_conforming_strings off \N Version and Platform Compatibility / Previous PostgreSQL Versions Causes '...' strings to treat backslashes literally. \N user bool \N \N \N off statement_timeout 0 ms Client Connection Defaults / Statement Behavior Sets the maximum allowed duration of any statement. A value of 0 turns off the timeout. user integer 0 2147483647 \N 0 stats_temp_directory pg_stat_tmp \N Statistics / Query and Index Statistics Collector Writes temporary statistics files to the specified directory. \N sighup string \N \N \N pg_stat_tmp superuser_reserved_connections 3 Connections and Authentication / Connection Settings Sets the number of connection slots reserved for superusers. \N postmaster integer 0 536870911 \N 3 synchronize_seqscans on \N Version and Platform Compatibility / Previous PostgreSQL Versions Enable synchronized sequential scans. \N user bool \N \N \N on synchronous_commit on \N Write-Ahead Log / Settings Sets immediate fsync at commit. \N user bool \N \N \N on syslog_facility local0 \N Reporting and Logging / Where to Log Sets the syslog "facility" to be used when syslog enabled. \N sighup enum \N \N {local0,local1,local2,local3,local4,local5,local6,local7} local0 syslog_ident postgres \N Reporting and Logging / Where to Log Sets the program name used to identify PostgreSQL messages in syslog. \N sighup string \N \N \N postgres tcp_keepalives_count 0 Client Connection Defaults / Other Defaults Maximum number of TCP keepalive retransmits. This controls the number of consecutive keepalive retransmits that can be lost before a connection is considered dead. A value of 0 uses the system default. user integer 0 2147483647 \N 0 tcp_keepalives_idle 0 s Client Connection Defaults / Other Defaults Time between issuing TCP keepalives. A value of 0 uses the system default. user integer 0 2147483647 \N 0 tcp_keepalives_interval 0 s Client Connection Defaults / Other Defaults Time between TCP keepalive retransmits. A value of 0 uses the system default. user integer 0 2147483647 \N 0 temp_buffers 1024 8kB Resource Usage / Memory Sets the maximum number of temporary buffers used by each session. \N user integer 100 1073741823 \N 1024 temp_tablespaces \N Client Connection Defaults / Statement Behavior Sets the tablespace(s) to use for temporary tables and sort files. \N user string \N \N \N TimeZone US/Eastern \N Client Connection Defaults / Locale and Formatting Sets the time zone for displaying and interpreting time stamps. \N user string \N \N \N UNKNOWN timezone_abbreviations Default \N Client Connection Defaults / Locale and Formatting Selects a file of time zone abbreviations. \N user string \N \N \N UNKNOWN trace_notify off \N Developer Options Generates debugging output for LISTEN and NOTIFY. \N user bool \N \N \N off trace_sort off \N Developer Options Emit information about resource usage in sorting. \N user bool \N \N \N off track_activities on \N Statistics / Query and Index Statistics Collector Collects information about executing commands. Enables the collection of information on the currently executing command of each session, along with the time at which that command began execution. superuser bool \N \N \N on track_activity_query_size 1024 Resource Usage / Memory Sets the size reserved for pg_stat_activity.current_query, in bytes. \N postmaster integer 100 102400 \N 1024 track_counts on \N Statistics / Query and Index Statistics Collector Collects statistics on database activity. \N superuser bool \N \N \N on track_functions none \N Statistics / Query and Index Statistics Collector Collects function-level statistics on database activity. \N superuser enum \N \N {none,pl,all} none transform_null_equals off \N Version and Platform Compatibility / Other Platforms and Clients Treats "expr=NULL" as "expr IS NULL". When turned on, expressions of the form expr = NULL (or NULL = expr) are treated as expr IS NULL, that is, they return true if expr evaluates to the null value, and false otherwise. The correct behavior of expr = NULL is to always return null (unknown). user bool \N \N \N off unix_socket_directory \N Connections and Authentication / Connection Settings Sets the directory where the Unix-domain socket will be created. \N postmaster string \N \N \N unix_socket_group \N Connections and Authentication / Connection Settings Sets the owning group of the Unix-domain socket. The owning user of the socket is always the user that starts the server. postmaster string \N \N \N unix_socket_permissions 511 Connections and Authentication / Connection Settings Sets the access permissions of the Unix-domain socket. Unix-domain sockets use the usual Unix file system permission set. The parameter value is expected to be a numeric mode specification in the form accepted by the chmod and umask system calls. (To use the customary octal format the number must start with a 0 (zero).) postmaster integer 0 511 \N 511 update_process_title on \N Statistics / Query and Index Statistics Collector Updates the process title to show the active SQL command. Enables updating of the process title every time a new SQL command is received by the server. superuser bool \N \N \N on vacuum_cost_delay 0 ms Resource Usage Vacuum cost delay in milliseconds. \N user integer 0 1000 \N 0 vacuum_cost_limit 200 Resource Usage Vacuum cost amount available before napping. \N user integer 1 10000 \N 200 vacuum_cost_page_dirty 20 Resource Usage Vacuum cost for a page dirtied by vacuum. \N user integer 0 10000 \N 20 vacuum_cost_page_hit 1 Resource Usage Vacuum cost for a page found in the buffer cache. \N user integer 0 10000 \N 1 vacuum_cost_page_miss 10 Resource Usage Vacuum cost for a page not found in the buffer cache. \N user integer 0 10000 \N 10 vacuum_freeze_min_age 100000000 Client Connection Defaults / Statement Behavior Minimum age at which VACUUM should freeze a table row. \N user integer 0 1000000000 \N 100000000 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_segment_size 2048 8kB Preset Options Shows the number of pages per write ahead log segment. \N internal integer 2048 2048 \N 2048 wal_sync_method fdatasync \N Write-Ahead Log / Settings Selects the method used for forcing WAL updates to disk. \N sighup enum \N \N {fsync,fdatasync,open_sync} fdatasync wal_writer_delay 200 ms Write-Ahead Log / Settings WAL writer sleep time between WAL flushes. \N sighup integer 1 10000 \N 200 work_mem 1024 kB Resource Usage / Memory Sets the maximum memory to be used for query workspaces. This much memory can be used by each internal sort operation and hash table before switching to temporary disk files. user integer 64 2147483647 \N 1024 xmlbinary base64 \N Client Connection Defaults / Statement Behavior Sets how binary values are to be encoded in XML. \N user enum \N \N {base64,hex} base64 xmloption content \N Client Connection Defaults / Statement Behavior Sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments. \N user enum \N \N {content,document} content zero_damaged_pages off \N Developer Options Continues processing past damaged page headers. Detection of a damaged page header normally causes PostgreSQL to report an error, aborting the current transaction. Setting zero_damaged_pages to true causes the system to instead report a warning, zero out the damaged page, and continue processing. This behavior will destroy data, namely all the rows on the damaged page. superuser bool \N \N \N off pgtune-0.9.3/pgtune000077500000000000000000000431311127216636700142720ustar00rootroot00000000000000#!/usr/bin/python """ pgtune Sample usage shown by running with "--help" """ import sys import os import datetime import optparse import csv import platform # Windows specific routines try: # ctypes is only available starting in Python 2.5 from ctypes import * # wintypes is only is available on Windows from ctypes.wintypes import * def Win32Memory(): class memoryInfo(Structure): _fields_ = [ ('dwLength', c_ulong), ('dwMemoryLoad', c_ulong), ('dwTotalPhys', c_ulong), ('dwAvailPhys', c_ulong), ('dwTotalPageFile', c_ulong), ('dwAvailPageFile', c_ulong), ('dwTotalVirtual', c_ulong), ('dwAvailVirtual', c_ulong) ] mi = memoryInfo() mi.dwLength = sizeof(memoryInfo) windll.kernel32.GlobalMemoryStatus(byref(mi)) return mi.dwTotalPhys except: # TODO Try and use MFI if we're on Python 2.4 (so no ctypes) but it's available? pass def totalMem(): try: if platform.system()=="Windows": totalMem=Win32Memory() else: # Should work on other, more UNIX-ish platforms physPages = os.sysconf("SC_PHYS_PAGES") pageSize = os.sysconf("SC_PAGE_SIZE") totalMem = physPages * pageSize return totalMem except: return None class PGConfigLine(object): """ Stores the value of a single line in the postgresql.conf file, with the following fields: lineNumber : integer originalLine : string commentSection : string setsParameter : boolean If setsParameter is True these will also be set: name : string readable : string raw : string This is the actual value delimiter (expectations are ' and ") """ def __init__(self,line,num=0): self.originalLine=line self.lineNumber=num self.setsParameter=False # Remove comments and edge whitespace self.commentSection="" commentIndex=line.find('#') if commentIndex >= 0: line=line[0:commentIndex] self.commentSection=line[commentIndex:] line=line.strip() if line == "": return # Split into name,value pair equalIndex=line.find('=') if equalIndex<0: return name,value=line.split('=',1) name=name.strip() value=value.strip() self.name=name; self.setsParameter=True; # Many types of values have ' ' characters around them, strip # TODO Set delimiter based on whether there is one here or not value=value.rstrip("'") value=value.lstrip("'") self.readable=value def outputFormat(self): s=self.originalLine; return s # Implement a Java-ish interface for this class that renames def value(self): return self.readable # TODO Returns the value as a raw number def internalValue(self,settings): return self.readable def isSetting(self): return self.setsParameter def __str__(self): s=str(self.lineNumber)+" sets?="+str(self.setsParameter) if self.setsParameter: s=s+" "+self.name+"="+self.value() # TODO: Include commentSection, readable,raw, delimiter s=s+" originalLine: "+self.originalLine return s class PGConfigFile(object): """ Read, write, and manage a postgresql.conf file There are two main structures here: configFile[]: Array of PGConfigLine entries for each line in the file settingLookup: Dictionary mapping parameter names to the line that set them """ def __init__(self, filename): self.readConfigFile(filename) def readConfigFile(self,filename): self.filename=filename self.settingsLookup={} self.configFile=[] lineNum=0; for line in open(filename): line=line.rstrip('\n') lineNum=lineNum + 1 configLine=PGConfigLine(line,lineNum) self.configFile.append(configLine) if configLine.isSetting(): # TODO Check if the line is already in the file, in which case # we should throw and error here suggesting that be corrected self.settingsLookup[configLine.name]=configLine # Much of this class will only operate with a settings database. # The only reason that isn't required by the constructuor itself # is that making it a second step introduces the possibility of # detecting which version someone is running, based on what # settings do and don't exist in their postgresql.conf def storeSettings(self,settingsInstance): settings=settingsInstance # Get the current value, assuming the default if that parameter # isn't set def currentValue(self,name): current=settings.boot_val(name) if self.settingsLookup.has_key(name): current=settings.parse(name,self.settingsLookup[name].value()) current=current.strip() return current # Get any numeric value the way the server will see it, so things # are always on the same scale. Returns None if this is not a # numeric value. # TODO Maybe throw an exception instead? # TODO Finish this implementation for integers, floats def numericValue(self,name,value): return None # TODO Check against min,max. Clip to edge and issue hint # if value is outside of server limits. def limitChecked(self,name,value): return None def updateSetting(self,name,newValue): current=self.currentValue(name) newValue=str(newValue).strip() # If it matches what's currently in the file, don't do anything if current==newValue: return # TODO Throw a HINT if you're reducing a value. This only makes # sense for integer and float settings, and presumes that there # aren't any settings where a lower value is more aggressive # TODO Clamp the new value against the min and max for this setting #print name,"min=",settings.min_val(name),"max=",settings.max_val(name) # Construct a new settings line newLineText=str(name)+" = "+str(newValue)+ \ " # pgtune wizard "+str(datetime.date.today()) newLine=PGConfigLine(newLineText) # Comment out any line already setting this value if self.settingsLookup.has_key(name): oldLine=self.settingsLookup[name] oldLineNum=oldLine.lineNumber commentedLineText="# "+oldLine.outputFormat() commentedLine=PGConfigLine(commentedLineText,oldLineNum) # Subtract one here to adjust for zero offset of array. # Any future change that adds lines in-place will need to do # something smarter here, because the line numbers won't match # the array indexes anymore self.configFile[oldLineNum-1]=commentedLine self.configFile.append(newLine) self.settingsLookup[name]=newLine def updateIfLarger(self,name,newValue): if self.settingsLookup.has_key(name): # TODO This comparison needs all the values converted to numeric form # and converted to the same scale before it will work if (True): #newValue > self.settingsLookup[name].value(): self.updateSetting(name,newValue) def writeConfigFile(self,fileHandle): for l in self.configFile: fileHandle.write(l.outputFormat()+"\n") def debugPrintInput(self): print "Original file:" for l in self.configFile: print str(l) def debugPrintSettings(self): print "Settings listing:" for k in self.settingsLookup.keys(): print k,'=',self.settingsLookup[k].value() class pg_settings(object): """ Read and index a delimited text dump of a typical pg_settings dump for the appropriate architecture--maximum values are different for some settings on 32 and 64 bit platforms. An appropriately formatted dump can be generated with: psql postgres -c "COPY (SELECT name,setting,unit,category,short_desc, extra_desc,context,vartype,min_val,max_val,enumvals,boot_val FROM pg_settings WHERE NOT source='override') TO '//pg_settings--'" Note that some of these columns (such as boot_val) are only available starting in PostgreSQL 8.4 """ def __init__(self,settings_dir): self.KB_PER_MB=1024 self.KB_PER_GB=1024*1024 self.readConfigFile(settings_dir) def readConfigFile(self,settings_dir): self.settingsLookup={} self.memoryUnits={} platformBits=32 if platform.architecture()[0]=="64bit": platformBits=64 # TODO Support handling versions other than 8.4 # TODO Allow passing in platform bit size settingDumpFile=os.path.join(settings_dir,"pg_settings-8.4-"+str(platformBits)) settingColumns=["name","setting","unit","category","short_desc", "extra_desc","context","vartype","min_val","max_val","enumvals", "boot_val"] reader = csv.DictReader(open(settingDumpFile), settingColumns, delimiter="\t") for d in reader: # Convert nulls into blanks for key in d.keys(): if d[key]=='\\N': d[key]="" # Memory units must be specified in some number of kB (never a larger # unit). Typically they are either "kB" for 1kB or "8kB", unless someone # compiled the server with a larger database or xlog block size # (BLCKSZ/XLOG_BLCKSZ). This code has no notion that such a thing is # possible though. d['memory_unit']=d['unit'].endswith('kB'); if d['memory_unit']: divisor=d['unit'].rstrip('kB') if divisor=='': divisor="1" d['memory_divisor']=int(divisor) else: d['memory_divisor']=None self.settingsLookup[d['name']]=d def debugPrintSettings(self): for key in self.settingsLookup.keys(): print "key=",key," value=",self.settingsLookup[key] def min_val(self,setting): return (self.settingsLookup[setting])['min_val'] def max_val(self,setting): return (self.settingsLookup[setting])['max_val'] def boot_val(self,setting): return (self.settingsLookup[setting])['boot_val'] def unit(self,setting): return (self.settingsLookup[setting])['unit'] def vartype(self,setting): return (self.settingsLookup[setting])['vartype'] def memory_unit(self,setting): return (self.settingsLookup[setting])['memory_unit'] def memory_divisor(self,setting): return (self.settingsLookup[setting])['memory_divisor'] def vartype(self,setting): return (self.settingsLookup[setting])['vartype'] def show(self,name,value): formatted=value s=self.settingsLookup[name] if s['memory_unit']: # Use the same logic as the GUC code that implements "SHOW". This uses # larger units only if there's no loss of resolution in displaying # with that value. Therefore, if using this to output newly assigned # values, that value needs to be rounded appropriately if you want # it to show up as an even number of MB or GB if (value % self.KB_PER_GB == 0): value=value/self.KB_PER_GB unit="GB" elif (value % self.KB_PER_MB == 0): value=value / self.KB_PER_MB; unit="MB" else: unit="kB" formatted=str(value)+unit # print >> sys.stderr,"Showing",name,"with value",value,"gives",formatted return formatted # Parse an integer value into its internal form. The main difficulty # here is that if that integer is a memory unit, you need to be aware # of what unit it is specified in. 1kB and 8kB pages are two popular ones # and that is reflected in memory_divisor def parse_int(self,name,value): s=self.settingsLookup[name] if self.memory_unit(name): if value.endswith('kB'): internal=int(value.rstrip('kB')) internal=internal / self.memory_divisor(name) elif value.endswith('MB'): internal=int(value.rstrip('MB')) internal=internal * self.KB_PER_MB / self.memory_divisor(name) elif value.endswith('GB'): internal=int(value.rstrip('GB')) internal=internal * self.KB_PER_GB / self.memory_divisor(name) else: internal=int(value) else: internal=int(value) return internal def parse(self,name,value): # Return a string representing the internal value this setting would # be parsed into. This includes converting memory values into their # internal integer representation if self.vartype(name)=="integer": return str(self.parse_int(name,value)) # TODO It might be helpful to eventually handle all the boolean # representations that the PostgreSQL GUC code understands, outputting # in standard form return value # Beginning of routines for this program def ReadOptions(): parser=optparse.OptionParser( usage="usage: %prog [options]", version="1.0", conflict_handler="resolve") parser.add_option('-i','--input-config',dest="inputConfig",default=None, help="Input configuration file") parser.add_option('-o','--output-config',dest="outputConfig",default=None, help="Output configuration file, defaults to standard output") parser.add_option('-M','--memory',dest="totalMemory",default=None, help="Total system memory, will attempt to detect if unspecified") parser.add_option('-T','--type',dest="dbType",default="Mixed", help="Database type, defaults to Mixed, valid options are DW, OLTP, Web, Mixed, Desktop") parser.add_option('-c','--connections',dest="connections",default=None, help="Maximum number of expected connections, default depends on database type") parser.add_option('-D','--debug',action="store_true",dest="debug", default="False",help="Enable debugging mode") parser.add_option('-S','--settings',dest="settings_dir",default=None, help="Directory where settings data files are located at. Defaults to the directory where the script is being run from") options,args=parser.parse_args() if options.debug==True: print "Command line options: ",options print "Command line arguments: ",args return options,args def binaryround(value): # Keeps the 4 most significant binary bits, truncates the rest so that # SHOW will be likely to use a larger divisor multiplier=1 while value>16: value=int(value/2) multiplier=multiplier * 2 return multiplier * value def wizardTune(config,options,settings): # We expect the following options are passed into here: # # dbType: Defaults to mixed # connections: If missing, will set based on dbType # totalMemory: If missing, will detect dbType=options.dbType.lower() # Save all settings to be updated as (setting,value) dictionary values s={} try: s['max_connections']={ 'web':200,'oltp':300,'dw':20,'mixed':80,'desktop':5}[dbType] except KeyError: print "Error: unexpected setting for dbType" sys.exit(1) # Now that we've screened for that, we know we've got a good dbType and # don't have to wrap the rest of these settings in an try block # Allow overriding the maximum connections if options.connections!=None: s['max_connections']=options.connections # Estimate memory on this system via parameter or system lookup totalMemory=options.totalMemory if totalMemory is None: totalMemory=totalMem() if totalMemory is None: print "Error: total memory not specified and unable to detect" sys.exit(1) kb=1024 mb=1024*kb gb=1024*mb # Memory allocation # Extract some values just to make the code below more compact # The base unit for memory types is the kB, so scale system memory to that mem=int(totalMemory) / kb con=int(s['max_connections']) if totalMemory>=(256*mb): if False: # platform.system()=="Windows" # TODO Adjust shared_buffers for Windows pass else: s['shared_buffers']={ 'web':mem/4, 'oltp':mem/4,'dw':mem/4, 'mixed':mem/4, 'desktop':mem/16}[dbType] s['effective_cache_size']={ 'web':mem*3/4, 'oltp':mem*3/4,'dw':mem*3/4, 'mixed':mem*3/4,'desktop':mem/4}[dbType] s['work_mem']={ 'web':mem/con, 'oltp':mem/con,'dw':mem/con/2, 'mixed':mem/con/2,'desktop':mem/con/6}[dbType] s['maintenance_work_mem']={ 'web':mem/16, 'oltp':mem/16,'dw':mem/8, 'mixed':mem/16,'desktop':mem/16}[dbType] # Cap maintenence RAM at 1GB on servers with lots of memory # (Remember that the setting is in terms of kB here) if s['maintenance_work_mem']>(1*mb): s['maintenance_work_mem']=1*mb; else: # TODO HINT about this tool not being optimal for low memory systems pass # Checkpoint parameters s['checkpoint_segments']={ 'web':8, 'oltp':16, 'dw':64, 'mixed':16, 'desktop':3}[dbType] s['checkpoint_completion_target']={ 'web':0.7, 'oltp':0.9, 'dw':0.9, 'mixed':0.9, 'desktop':0.5}[dbType] s['wal_buffers']=512 * s['checkpoint_segments'] # Paritioning and statistics s['constraint_exclusion']={ 'web':'off', 'oltp':'off', 'dw':'on', 'mixed':'on', 'desktop':'off'}[dbType] s['default_statistics_target']={ 'web':10, 'oltp':10, 'dw':100, 'mixed':50, 'desktop':10}[dbType] for key in s.keys(): value=s[key] # TODO Make this logic part of the config class, so this # function doesn't need to be passed settings if settings.memory_unit(key): value=binaryround(s[key]) # TODO Add show method to config class for similar reasons config.updateSetting(key,settings.show(key,value)) if __name__=='__main__': options,args=ReadOptions() configFile=options.inputConfig if configFile is None: print >> sys.stderr,"Can't do anything without an input config file; try --help" sys.exit(1) # TODO Show usage here config=PGConfigFile(configFile) if options.debug==True: config.debugPrintInput() print config.debugPrintSettings() if options.settings_dir is None: options.settings_dir=os.path.abspath(os.path.dirname(sys.argv[0])) settings=pg_settings(options.settings_dir) config.storeSettings(settings) wizardTune(config,options,settings) outputFileName=options.outputConfig if outputFileName is None: outputFile=sys.stdout else: outputFile=open(outputFileName,'w') config.writeConfigFile(outputFile) pgtune-0.9.3/pgtune-settingsdir.patch000066400000000000000000000010711127216636700177170ustar00rootroot00000000000000--- pgtune.old 2009-10-29 00:49:32.000000000 +0200 +++ pgtune 2009-10-29 00:49:51.000000000 +0200 @@ -414,7 +414,7 @@ parser.add_option('-D','--debug',action="store_true",dest="debug", default="False",help="Enable debugging mode") - parser.add_option('-S','--settings',dest="settings_dir",default=None, + parser.add_option('-S','--settings',dest="settings_dir",default="/usr/share/pgtune", help="Directory where settings data files are located at. Defaults to the directory where the script is being run from") options,args=parser.parse_args() pgtune-0.9.3/pgtune.spec000066400000000000000000000023521127216636700152200ustar00rootroot00000000000000Summary: PostgreSQL Config Tuner Name: pgtune Version: 0.9.2 Release: 1%{?dist} License: BSD Group: Applications/Databases URL: http://pgfoundry.org/projects/pgtune BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Source0: http://pgfoundry.org/frs/download.php/2445/%{name}-%{version}.tar.gz Patch0: pgtune-settingsdir.patch Requires: postgresql-server Buildarch: noarch %description pgtune takes the wimpy default postgresql.conf and expands the database server to be as powerful as the hardware it's being deployed on. %prep %setup -q -n %{name}-%{version} %patch0 -p0 %build %install rm -rf %{buildroot} install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_datadir}/%{name} install -m 755 pgtune %{buildroot}%{_bindir} install -m 644 -p pg_settings* %{buildroot}%{_datadir}/%{name} %clean rm -rf %{buildroot} %files %defattr(0644,root,root,0755) %doc TODO COPYRIGHT %dir %{_datadir}/%{name} %{_datadir}/%{name}/* %attr(755,root,root) %{_bindir}/pgtune %changelog * Wed Oct 28 2009 Devrim Gunduz 0.9.1-1 - Initial packaging for PostgreSQL RPM Repository * Wed Oct 28 2009 Greg Smith 0.9.2-1 - Added copyright file, doesn't install sample postgresql.conf file. pgtune-0.9.3/postgresql.conf.sample000066400000000000000000000413271127216636700174010ustar00rootroot00000000000000# ----------------------------- # PostgreSQL configuration file # ----------------------------- # # This file consists of lines of the form: # # name = value # # (The "=" is optional.) Whitespace may be used. Comments are introduced with # "#" anywhere on a line. The complete list of parameter names and allowed # values can be found in the PostgreSQL documentation. # # The commented-out settings shown in this file represent the default values. # Re-commenting a setting is NOT sufficient to revert it to the default value; # you need to reload the server. # # This file is read on server startup and when the server receives a SIGHUP # signal. If you edit the file on a running system, you have to SIGHUP the # server for the changes to take effect, or use "pg_ctl reload". Some # parameters, which are marked below, require a server shutdown and restart to # take effect. # # Any parameter can also be given as a command-line option to the server, e.g., # "postgres -c log_connections=on". Some parameters can be changed at run time # with the "SET" SQL command. # # Memory units: kB = kilobytes Time units: ms = milliseconds # MB = megabytes s = seconds # GB = gigabytes min = minutes # h = hours # d = days #------------------------------------------------------------------------------ # FILE LOCATIONS #------------------------------------------------------------------------------ # The default values of these variables are driven from the -D command-line # option or PGDATA environment variable, represented here as ConfigDir. #data_directory = 'ConfigDir' # use data in another directory # (change requires restart) #hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file # (change requires restart) #ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file # (change requires restart) # If external_pid_file is not explicitly set, no extra PID file is written. #external_pid_file = '(none)' # write an extra PID file # (change requires restart) #------------------------------------------------------------------------------ # CONNECTIONS AND AUTHENTICATION #------------------------------------------------------------------------------ # - Connection Settings - #listen_addresses = 'localhost' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost', '*' = all # (change requires restart) #port = 5432 # (change requires restart) max_connections = 100 # (change requires restart) # Note: Increasing max_connections costs ~400 bytes of shared memory per # connection slot, plus lock space (see max_locks_per_transaction). #superuser_reserved_connections = 3 # (change requires restart) #unix_socket_directory = '' # (change requires restart) #unix_socket_group = '' # (change requires restart) #unix_socket_permissions = 0777 # begin with 0 to use octal notation # (change requires restart) #bonjour = off # advertise server via Bonjour # (change requires restart) #bonjour_name = '' # defaults to the computer name # (change requires restart) # - Security and Authentication - #authentication_timeout = 1min # 1s-600s #ssl = off # (change requires restart) #ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers # (change requires restart) #password_encryption = on #db_user_namespace = off # Kerberos and GSSAPI #krb_server_keyfile = '' #krb_srvname = 'postgres' # (Kerberos only) #krb_caseins_users = off # - TCP Keepalives - # see "man 7 tcp" for details #tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds; # 0 selects the system default #tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds; # 0 selects the system default #tcp_keepalives_count = 0 # TCP_KEEPCNT; # 0 selects the system default #------------------------------------------------------------------------------ # RESOURCE USAGE (except WAL) #------------------------------------------------------------------------------ # - Memory - shared_buffers = 32MB # min 128kB # (change requires restart) #temp_buffers = 8MB # min 800kB #max_prepared_transactions = 0 # zero disables the feature # (change requires restart) # Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory # per transaction slot, plus lock space (see max_locks_per_transaction). # It is not advisable to set max_prepared_transactions nonzero unless you # actively intend to use prepared transactions. #work_mem = 1MB # min 64kB #maintenance_work_mem = 16MB # min 1MB #max_stack_depth = 2MB # min 100kB # - Kernel Resource Usage - #max_files_per_process = 1000 # min 25 # (change requires restart) #shared_preload_libraries = '' # (change requires restart) # - Cost-Based Vacuum Delay - #vacuum_cost_delay = 0ms # 0-100 milliseconds #vacuum_cost_page_hit = 1 # 0-10000 credits #vacuum_cost_page_miss = 10 # 0-10000 credits #vacuum_cost_page_dirty = 20 # 0-10000 credits #vacuum_cost_limit = 200 # 1-10000 credits # - Background Writer - #bgwriter_delay = 200ms # 10-10000ms between rounds #bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round #bgwriter_lru_multiplier = 2.0 # 0-10.0 multipler on buffers scanned/round # - Asynchronous Behavior - #effective_io_concurrency = 1 # 1-1000. 0 disables prefetching #------------------------------------------------------------------------------ # WRITE AHEAD LOG #------------------------------------------------------------------------------ # - Settings - #fsync = on # turns forced synchronization on or off #synchronous_commit = on # immediate fsync at commit #wal_sync_method = fsync # the default is the first option # supported by the operating system: # open_datasync # fdatasync # fsync # fsync_writethrough # open_sync #full_page_writes = on # recover from partial page writes #wal_buffers = 64kB # min 32kB # (change requires restart) #wal_writer_delay = 200ms # 1-10000 milliseconds #commit_delay = 0 # range 0-100000, in microseconds #commit_siblings = 5 # range 1-1000 # - Checkpoints - #checkpoint_segments = 3 # in logfile segments, min 1, 16MB each #checkpoint_timeout = 5min # range 30s-1h #checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0 #checkpoint_warning = 30s # 0 disables # - Archiving - #archive_mode = off # allows archiving to be done # (change requires restart) #archive_command = '' # command to use to archive a logfile segment #archive_timeout = 0 # force a logfile segment switch after this # number of seconds; 0 disables #------------------------------------------------------------------------------ # QUERY TUNING #------------------------------------------------------------------------------ # - Planner Method Configuration - #enable_bitmapscan = on #enable_hashagg = on #enable_hashjoin = on #enable_indexscan = on #enable_mergejoin = on #enable_nestloop = on #enable_seqscan = on #enable_sort = on #enable_tidscan = on # - Planner Cost Constants - #seq_page_cost = 1.0 # measured on an arbitrary scale #random_page_cost = 4.0 # same scale as above #cpu_tuple_cost = 0.01 # same scale as above #cpu_index_tuple_cost = 0.005 # same scale as above #cpu_operator_cost = 0.0025 # same scale as above #effective_cache_size = 128MB # - Genetic Query Optimizer - #geqo = on #geqo_threshold = 12 #geqo_effort = 5 # range 1-10 #geqo_pool_size = 0 # selects default based on effort #geqo_generations = 0 # selects default based on effort #geqo_selection_bias = 2.0 # range 1.5-2.0 #geqo_seed = 0.0 # range 0.0-1.0 # - Other Planner Options - #default_statistics_target = 100 # range 1-10000 #constraint_exclusion = partition # on, off, or partition #cursor_tuple_fraction = 0.1 # range 0.0-1.0 #from_collapse_limit = 8 #join_collapse_limit = 8 # 1 disables collapsing of explicit # JOIN clauses #------------------------------------------------------------------------------ # ERROR REPORTING AND LOGGING #------------------------------------------------------------------------------ # - Where to Log - #log_destination = 'stderr' # Valid values are combinations of # stderr, csvlog, syslog and eventlog, # depending on platform. csvlog # requires logging_collector to be on. # This is used when logging to stderr: #logging_collector = off # Enable capturing of stderr and csvlog # into log files. Required to be on for # csvlogs. # (change requires restart) # These are only used if logging_collector is on: #log_directory = 'pg_log' # directory where log files are written, # can be absolute or relative to PGDATA #log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern, # can include strftime() escapes #log_truncate_on_rotation = off # If on, an existing log file of the # same name as the new log file will be # truncated rather than appended to. # But such truncation only occurs on # time-driven rotation, not on restarts # or size-driven rotation. Default is # off, meaning append to existing files # in all cases. #log_rotation_age = 1d # Automatic rotation of logfiles will # happen after that time. 0 disables. #log_rotation_size = 10MB # Automatic rotation of logfiles will # happen after that much log output. # 0 disables. # These are relevant when logging to syslog: #syslog_facility = 'LOCAL0' #syslog_ident = 'postgres' #silent_mode = off # Run server silently. # DO NOT USE without syslog or # logging_collector # (change requires restart) # - When to Log - #client_min_messages = notice # values in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # log # notice # warning # error #log_min_messages = warning # values in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # log # fatal # panic #log_error_verbosity = default # terse, default, or verbose messages #log_min_error_statement = error # values in order of decreasing detail: # debug5 # debug4 # debug3 # debug2 # debug1 # info # notice # warning # error # log # fatal # panic (effectively off) #log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements # and their durations, > 0 logs only # statements running at least this number # of milliseconds # - What to Log - #debug_print_parse = off #debug_print_rewritten = off #debug_print_plan = off #debug_pretty_print = on #log_checkpoints = off #log_connections = off #log_disconnections = off #log_duration = off #log_hostname = off #log_line_prefix = '' # special values: # %u = user name # %d = database name # %r = remote host and port # %h = remote host # %p = process ID # %t = timestamp without milliseconds # %m = timestamp with milliseconds # %i = command tag # %e = SQL state # %c = session ID # %l = session line number # %s = session start timestamp # %v = virtual transaction ID # %x = transaction ID (0 if none) # %q = stop here in non-session # processes # %% = '%' # e.g. '<%u%%%d> ' #log_lock_waits = off # log lock waits >= deadlock_timeout #log_statement = 'none' # none, ddl, mod, all #log_temp_files = -1 # log temporary files equal or larger # than the specified size in kilobytes; # -1 disables, 0 logs all temp files #log_timezone = unknown # actually, defaults to TZ environment # setting #------------------------------------------------------------------------------ # RUNTIME STATISTICS #------------------------------------------------------------------------------ # - Query/Index Statistics Collector - #track_activities = on #track_counts = on #track_functions = none # none, pl, all #track_activity_query_size = 1024 #update_process_title = on #stats_temp_directory = 'pg_stat_tmp' # - Statistics Monitoring - #log_parser_stats = off #log_planner_stats = off #log_executor_stats = off #log_statement_stats = off #------------------------------------------------------------------------------ # AUTOVACUUM PARAMETERS #------------------------------------------------------------------------------ #autovacuum = on # Enable autovacuum subprocess? 'on' # requires track_counts to also be on. #log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and # their durations, > 0 logs only # actions running at least this number # of milliseconds. #autovacuum_max_workers = 3 # max number of autovacuum subprocesses #autovacuum_naptime = 1min # time between autovacuum runs #autovacuum_vacuum_threshold = 50 # min number of row updates before # vacuum #autovacuum_analyze_threshold = 50 # min number of row updates before # analyze #autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum #autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze #autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum # (change requires restart) #autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for # autovacuum, in milliseconds; # -1 means use vacuum_cost_delay #autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for # autovacuum, -1 means use # vacuum_cost_limit #------------------------------------------------------------------------------ # CLIENT CONNECTION DEFAULTS #------------------------------------------------------------------------------ # - Statement Behavior - #search_path = '"$user",public' # schema names #default_tablespace = '' # a tablespace name, '' uses the default #temp_tablespaces = '' # a list of tablespace names, '' uses # only default tablespace #check_function_bodies = on #default_do_language = 'plpgsql' #default_transaction_isolation = 'read committed' #default_transaction_read_only = off #session_replication_role = 'origin' #statement_timeout = 0 # in milliseconds, 0 is disabled #vacuum_freeze_min_age = 50000000 #vacuum_freeze_table_age = 150000000 #bytea_output = 'hex' # hex, escape #xmlbinary = 'base64' #xmloption = 'content' # - Locale and Formatting - datestyle = 'iso, mdy' #intervalstyle = 'postgres' #timezone = unknown # actually, defaults to TZ environment # setting #timezone_abbreviations = 'Default' # Select the set of available time zone # abbreviations. Currently, there are # Default # Australia # India # You can create your own file in # share/timezonesets/. #extra_float_digits = 0 # min -15, max 3 #client_encoding = sql_ascii # actually, defaults to database # encoding # These settings are initialized by initdb, but they can be changed. lc_messages = 'en_US.UTF-8' # locale for system error message # strings lc_monetary = 'en_US.UTF-8' # locale for monetary formatting lc_numeric = 'en_US.UTF-8' # locale for number formatting lc_time = 'en_US.UTF-8' # locale for time formatting # default configuration for text search default_text_search_config = 'pg_catalog.english' # - Other Defaults - #dynamic_library_path = '$libdir' #local_preload_libraries = '' #------------------------------------------------------------------------------ # LOCK MANAGEMENT #------------------------------------------------------------------------------ #deadlock_timeout = 1s #max_locks_per_transaction = 64 # min 10 # (change requires restart) # Note: Each lock table slot uses ~270 bytes of shared memory, and there are # max_locks_per_transaction * (max_connections + max_prepared_transactions) # lock table slots. #------------------------------------------------------------------------------ # VERSION/PLATFORM COMPATIBILITY #------------------------------------------------------------------------------ # - Previous PostgreSQL Versions - #add_missing_from = off #array_nulls = on #backslash_quote = safe_encoding # on, off, or safe_encoding #default_with_oids = off #escape_string_warning = on #regex_flavor = advanced # advanced, extended, or basic #sql_inheritance = on #standard_conforming_strings = off #synchronize_seqscans = on # - Other Platforms and Clients - #transform_null_equals = off #------------------------------------------------------------------------------ # CUSTOMIZED OPTIONS #------------------------------------------------------------------------------ #custom_variable_classes = '' # list of custom variable class names # Lines that pgtune has had problems parsing log_line_prefix = 'user=%u,db=%d '