当前位置:网站首页>Database postragesql client connection default
Database postragesql client connection default
2022-07-05 01:05:00 【wx5d0241bb88268】
19.11. The default value of client connection
19.11.1. Statement behavior
client_min_messages (enum)
Controls the level of messages sent to clients . Valid values are DEBUG5、 DEBUG4、DEBUG3、DEBUG2、 DEBUG1、LOG、NOTICE、 WARNING、ERROR. Each level includes all subsequent levels . The lower the level , The fewer messages are sent . The default value is NOTICE. Be careful LOG There is a connection with log_min_messages Different rankings in .
INFO Level messages are always sent to the client .
search_path (string)
This variable specifies when an object ( surface 、 data type 、 Functions, etc ) When referenced by a simple name with no schema qualification , The pattern order used to search the object . When there are objects with the same name in different modes , The first object found in the search path will be used . An object that does not belong to any pattern in the search path can only be named by qualified ( With dot ) Specify the schema that contains it to reference .
search_path
The value of must be a comma separated list of schema names . Any name that is not an existing schema , Or a user does not have USAGE Permission mode , Will be quietly ignored .
If one of the list items is a special name $user
, It has SESSION_USER
The pattern of the returned name will replace it ( If there is such a mode and the user has such a mode USAGE jurisdiction ; without ,$user
Will be ignored ).
System directory mode pg_catalog
Always searched , Whether or not it is mentioned in the search path . If it is mentioned in the path , Then it will be searched in the order specified by the path . If pg_catalog
Not in the path , Then it will be searched before any path item .
Again , Temporary table mode of the current session pg_temp_nnn
Is always searched ( If there is ). It can use aliases in the path pg_temp
Explicitly list . If not listed in the path , Then it will be searched first ( Even in pg_catalog Before ). However , Temporary patterns are only used to search for relationships ( surface 、 View 、 Sequence, etc ) And data type name . It is never used to search for function or operator names .
When the object is created, no specific target pattern is specified , They will be placed in search_path
In the first legal mode . If the search path is empty, an error will be reported .
The default value for this parameter is "$user", public. This setting supports a database ( None of the users have private mode , And everyone shares it public)、 The shared use of each user's private mode and its combination . Other effects can be achieved by modifying the default search path settings globally or for each user .
More information about program processing , Please refer to Section 5.8. Specially , Only when the database has only one user or a few users who trust each other , The default configuration is appropriate .
The current valid value of the search path can be through SQL function current_schemas
Check ( see Section 9.25). It and inspection search_path
The value of is different , because current_schemas
The display appears in search_path
How items in are resolved .
row_security (boolean)
This variable controls whether to throw an error instead of applying a row security policy . When it is set to on when , The strategy is applied normally . When it is set to off when , As long as at least one policy is applied, the query will fail . The default is on. When restricted row visibility leads to incorrect results , It can be changed to off. for example ,pg_dump This change will be made by default . This variable pairs the roles that can bypass the security policy of each row ( That is, super users and BYPASSRLS) The role of attribute has no effect .
For more information about row security policies, see CREATE POLICY.
default_tablespace (string)
This variable specifies when a CREATE When the command does not explicitly specify a tablespace , Create objects ( Tables and indexes ) The default tablespace for .
The value is either the name of a table space , Or an empty string that specifies to use the default tablespace of the current database . If the value does not match the name of any existing tablespace ,PostgreSQL The default tablespace of the current database will be automatically used . If a non default table space is specified , Users must have CREATE jurisdiction , Otherwise, the creation attempt will fail .
This variable is not used for temporary tables , For temporary tables temp_tablespaces. This variable is also used when creating the database . By default , A new database will inherit its tablespace settings from its template database . More information about tablespaces , Please see Section 22.6.
temp_tablespaces (string)
This variable specifies when a CREATE When the command does not explicitly specify a tablespace , Create temporary objects ( Temporary tables and indexes on temporary tables ) The default tablespace for . Temporary files for sorting large datasets are also created in these tablespaces .
This value is a list of tablespace names . When there is more than one name in the list , Every time a temporary object is created PostgreSQL Randomly select a member in the list . The exception is in a transaction , Temporary objects created consecutively are placed in contiguous table spaces in the inner table . If the list is selected, the element is an empty string ,PostgreSQL The default tablespace of the current database will be automatically used .
When temp_tablespaces
When set interactively , Specifying a nonexistent table space is an error , It is similar to specifying a user without CREATE Permission table space . however , When using a previously set value , Nonexistent table spaces will be ignored , Just like users lack CREATE Permissions are the same as tablespaces . Specifically , Use one in postgresql.conf When the value set in , This rule works .
The default value is an empty string , It enables all temporary objects to be created in the default table space of the current database .
Refer to the default_tablespace.
check_function_bodies (boolean)
This parameter is usually on . When set to off when , It is disabled CREATE FUNCTION During the validation of the function body string . Disabling validation avoids the side effects of validation processing and avoids false positives such as forward references . Set this parameter to... Before loading the function on behalf of other users off;pg_dump Will automatically do this .
default_transaction_isolation (enum)
Every SQL Transactions have an isolation level , It can be “ Read uncommitted ”、“ Read submitted ”、“ Repeatable ” perhaps “ Serializable ”. This parameter controls the default isolation level of each new transaction . The default is “ Read submitted ”.
For more information, see Chapter 13 and SET TRANSACTION.
default_transaction_read_only (boolean)
A read-only SQL Transactions cannot modify non temporary tables . This parameter controls the default read-only state of each new transaction . The default is off( read / Write ).
For more information, please refer to SET TRANSACTION.
default_transaction_deferrable (boolean)
When running at serializable isolation level , A deferred read-only SQL A transaction can be delayed for a period of time before it is allowed to continue . however , Once it starts executing, it will not generate any load to ensure serializability ; Therefore, serialization code will have no reason to force it to break due to concurrent updates , Make this option suitable for long-running read-only transactions .
This parameter controls the default deferrable state of each new transaction . At present, it is invalid for read-write transactions or transactions whose operations are below the serializable isolation level . The default value is off.
Please refer to SET TRANSACTION.
session_replication_role (enum)
Controls the triggering of replication related triggers and rules for the current session . You need super user permission to set this variable , And it will result in discarding any previously cached query plans . The possible values are origin( Default )、replica and local.
The intended use of this setting is for the logical replication system to set it to replica. The effect will be triggers and rules ( The default configuration has not been modified ) It will not be triggered on the copier . For more information, please refer to ALTER TABLE Clause of ENABLE TRIGGER as well as ENABLE RULE.
PostgreSQL Internally, it will set origin and local Treat the same . Third party replication systems may use these two values for their internal purposes , For example, put local Used to mark a session whose changes should not be copied .
Because foreign keys are implemented as triggers , Set this parameter to replica It also disables all foreign key checking , If used improperly, the data may be in an inconsistent state .
statement_timeout (integer)
Abort any statement that uses more than the specified number of milliseconds , The timing starts when the command arrives at the server . If log_min_error_statement
Set to ERROR Or lower , If the statement times out, it will also be recorded . A zero value ( Default ) This parameter will be turned off .
We do not recommend postgresql.conf Set in statement_timeout, Because it will affect all sessions .
lock_timeout (integer)
If any statement is trying to get a table 、 Indexes 、 Wait for a lock on a row or other database object to exceed the specified number of milliseconds , The statement will be aborted . This time limit is applied independently to each lock acquisition attempt . This restriction applies to explicit lock requests ( Such as LOCK TABLE Or without NOWAIT Of SELECT FOR UPDATE) And implicitly acquired locks . If log_min_error_statement
Set to ERROR Or lower , Timeout statements will be recorded . A zero value ( Default ) This parameter will be turned off .
And statement_timeout
Different , This timeout only occurs when waiting for a lock . Note that if statement_timeout
Is nonzero , Set up lock_timeout
It doesn't make sense for the same or greater value , Because the transaction timeout will always be triggered first .
We do not recommend postgresql.conf Set in lock_timeout, Because it will affect all sessions .
idle_in_transaction_session_timeout (integer)
Terminate any idle for more than the time specified by this parameter ( In milliseconds ) Open a transaction session . This causes any locks held by the session to be released , And the connection slot it holds can be reused , It also allows tuples visible only to this transaction to be cleaned up . For details about this, please see Section 24.1.
The default value is 0 Will disable this feature .
vacuum_freeze_table_age (integer)
When the table pg_class.relfrozenxid When the domain reaches the age specified by this setting ,VACUUM Will perform a radical scan . Radical scanning and routine VACUUM The difference is that it will access every one that may contain unfrozen XID perhaps MXID The page of , Not just those pages that may contain dead tuples . The default value is 1.5 A hundred million things . Although the user can set this value from 0 To 20 Billion ,VACUUM Will quietly set the valid value to autovacuum_freeze_max_age It's worth it 95%, Therefore, there is an opportunity to perform a regular manual cleaning before starting a rewind automatic cleaning on the table VACUUM. For more information, see Section 24.1.5.
vacuum_freeze_min_age (integer)
Appoint VACUUM It is used to decide whether to freeze the cut-off age of row version when scanning the table ( In terms of transactions ). The default value is 5 Thousands of things . Although the user can set this value from 0 To 10 Billion ,VACUUM Will quietly set the valid value to autovacuum_freeze_max_age
Half of the value , In this way, there will be no short time interval between enforced automatic cleaning . For more information, see Section 24.1.5.
vacuum_multixact_freeze_table_age (integer)
If the watch pg_class.relminmxid
The domain is older than the age specified by this setting ,VACUUM Will perform a radical scan . Radical scanning and routine VACUUM The difference is that it will access every one that may contain unfrozen XID perhaps MXID The page of , Instead of just scanning pages that may contain dead tuples . The default value is 1.5 Billion portfolio transactions . Although the user can set this value from 0 To 20 Billion ,VACUUM Will quietly set the valid value to autovacuum_multixact_freeze_max_age
It's worth it 95%, Therefore, there is an opportunity to perform a regular manual cleaning before starting a rewind automatic cleaning on the table VACUUM. For more information, see Section 24.1.5.1.
vacuum_multixact_freeze_min_age (integer)
Appoint VACUUM Used to decide whether to combine transactions when scanning the table ID Replace with an updated transaction ID Or combine transactions ID Cut off age ( By combined transactions ). The default value is 5 Thousands of composite transactions . Although the user can set this value from 0 To 10 Billion ,VACUUM Will quietly set the valid value to autovacuum_multixact_freeze_max_age
Half of the value , In this way, there will be no short time interval between enforced automatic cleaning . For more information, see Section 24.1.5.1.
vacuum_cleanup_index_scale_factor (floating point)
Specifies a fraction of the total number of heap tuples counted during previous statistics collection , Inserting tuples that do not exceed this number will not result in VACUUM Index scan during cleanup . This setting currently only applies to B- Tree index .
If no tuples are deleted from the heap , Then at least one of the following conditions is met , stay VACUUM The cleanup phase will still scan B- Tree index : The index statistics are out of date or the index contains deleted pages that can be recycled during cleanup . If the number of newly inserted tuples accounts for more than vacuum_cleanup_index_scale_factor
, The index information is considered obsolete . The total number of heap tuples is stored in the meta page of the index . Be careful , until VACUUM Before the death tuple cannot be found , This data is not included in the original page . So only in the second and after VACUUM When a dead tuple is not detected by the cycle , In the clean-up phase B- The tree index scan can be skipped .
The value range of this value can be from 0 To 10000000000. When vacuum_cleanup_index_scale_factor Set to 0 when , stay VACUUM Index scans will not be skipped during cleanup . The default value is 0.1.
bytea_output (enum)
Set up bytea Output format of type value . Valid values are hex( Default ) and escape( Conventional PostgreSQL Format ). See Section 8.4. Regardless of the value of this setting ,bytea Type always accepts input in both formats .
xmlbinary (enum)
Set how binary values are encoded as XML. for example , This applies through xmlelement Function or xmlforest Function will bytea Value to XML value . The possible values are base64 and hex, They all use XML The schema standard defines . The default value is base64. More about XML For information about related functions, see Section 9.14.
The actual choices here are based on hobbies , Only subject to the restrictions that may exist in the client application . Both methods support all possible values , Although hexadecimal encoding will be better than base64 Larger encoding .
xmloption (enum)
When in XML And string value , No matter the setting DOCUMENT or CONTENT It's all implicit . Please see the Section 8.13. Valid values are DOCUMENT and CONTENT. The default value is CONTENT. When in XML And string value , Set up DOCUMENT or CONTENT It's all implicit . See Section 8.13. Valid values are DOCUMENT and CONTENT. The default value is CONTENT.
according to SQL standard , The command to set this option is :SET XML OPTION { DOCUMENT | CONTENT }
; This grammar PostgreSQL Also available .
gin_pending_list_limit (integer)
Set up fastupdate Can be used when enabled GIN The maximum size of the list to be processed . If the list grows beyond this maximum size , The items will be moved to the master by batch GIN Data structure to clean up the list . The default value is four megabytes (4MB). You can change the storage parameters of the index to set the storage parameters for individual GIN Index overrides this setting . For more information, see Section 66.4.1 and Section 66.5.
19.11.2. Area and formatting
DateStyle (string)
Format the display of date and time values , And rules for interpreting ambiguous date input values . For historical reasons , This variable contains two independent parts : Output format declaration (ISO、Postgres、SQL or German)、 Input / Year of output / month / Day order (DMY、MDY or YMD). These can be set independently or together . keyword Euro and European yes DMY A synonym for ; keyword US、NonEuro and NonEuropean yes MDY A synonym for .
See Section 8.5. The built-in default is ISO, MDY, however initdb Will be used corresponding to the selected lc_time Initialize the configuration file according to the setting of regional behavior .
IntervalStyle (enum)
Set the display format of interval value . value sql_standard Will produce a match SQL Output of standard interval text . When DateStyle Parameter is set to ISO when , value postgres( Default ) Will produce a match PostgreSQL issue 8.4 Previous output . When DateStyle The parameter is set to non ISO When the output , value postgres_verbose Will produce a match PostgreSQL issue 8.4 Previous output . value iso_8601 Will produce a match in ISO 8601 Of 4.4.3.2 As defined in section “ Flag format ” The output of the time interval .
IntervalStyle Parameters can also affect the interpretation of ambiguous interval inputs . See Section 8.5.4.
TimeZone (string)
Set the time zone used to display and interpret timestamps . The built-in default is GMT, But it usually happens in postgresql.conf Is covered in ;initdb A setting corresponding to its system environment will be installed . See Section 8.5.3.
timezone_abbreviations (string)
Set the time zone abbreviation set used in the date and time input accepted by the server . The default value is ’Default’, This collection works in most parts of the world . There's also ’Australia’ and ’India’, And other collections that may be defined for a particular installation . See Section B.4.
extra_float_digits (integer)
This parameter adjusts the number of digits displayed for floating-point values , Include float4、float8 And geometric data types . The parameter value is added to the standard number of digits (FLT_DIG or DBL_DIG, As the case may be ) On . This value can be set up to 3 To include some significant bits ; This is especially helpful for dumping non point data that needs to be accurately recovered . Or it can be set to a negative value to eliminate unwanted bits . See also Section 8.1.3.
client_encoding (string)
Set client code ( Character set ). Database encoding is used by default .PostgreSQL The character set supported by the server is Section 23.3.1 Description in .
lc_messages (string)
Set the language in which the message is displayed . Acceptable values are system dependent ; See Section 23.1. If this variable is set to an empty string ( Default ), Then the value will be inherited from the server's execution environment in a system related manner .
On some systems , This regional classification does not exist . You can still set this variable , It just won't have any effect . Again , The translation message of the desired language may also not exist . under these circumstances , You will continue to see English news .
Only super users can change this setting . Because it affects messages sent to both the server log and the client . An incorrect value may reduce the readability of the server log .
lc_monetary (string)
Set the area used to format the monetary amount , For example to_char Family of functions . Acceptable values are system dependent ; See Section 23.1. If this variable is set to an empty string ( Default ), Then the value will be inherited from the server's execution environment in a system related manner .
lc_numeric (string)
Set the area used to format numbers , For example to_char Family of functions . Acceptable values are system dependent ; See Section 23.1. If this variable is set to an empty string ( Default ), Then the value will be inherited from the server's execution environment in a system related manner .
lc_time (string)
Set the area used to format the date and time , For example to_char Family of functions . Acceptable values are system dependent ; See Section 23.1. If this variable is set to an empty string ( Default ), Then the value will be inherited from the server's execution environment in a system related manner .
default_text_search_config (string)
Select the text search configuration used by variants of the text search function that do not have an explicit parameter specified configuration . See Chapter 12. The built-in default is pg_catalog.simple
, But if you can identify the configuration of a matching area ,initdb Will be used corresponding to the selected lc_ctype Initialize the configuration file according to the settings of the region .
19.11.3. Shared library preload
In order to load additional functions or improve performance , Multiple settings can be used to preload shared libraries into the server . for example ’$libdir/mylib’ Setting may cause mylib.so( Or on some platforms mylib.sl) Preloaded from the installed standard library directory . The difference between these settings is when they take effect and the privileges required to change them .
You can use this method to preload PostgreSQL Process language library , It is usually used ’$libdir/plXXX’ grammar , Among them XXX yes pgsql、perl、tcl or python.
Only specially for PostgreSQL Shared libraries designed together can be loaded in this way . every last PostgreSQL Support All libraries have one “ Magic block ”, It will be checked to ensure compatibility . For this reason , Not PostgreSQL Cannot be loaded in this way . You may be able to use the tools of the operating system ( Such as LD_PRELOAD) Load it .
All in all , Please refer to the documentation of the specific module to load it in the recommended way .
local_preload_libraries (string)
This variable specifies one or more shared libraries to be preloaded at the beginning of the connection . It contains a comma separated list of library names , For each of these names, press LOAD Command mode parsing . Spaces between items are ignored , If you need to include spaces or commas in the library name , Please put the library name in double quotation marks . This parameter Value only takes effect at the beginning of the connection . Subsequent changes will have no effect . If a specified The library didn't find , The connection attempt will fail .
Any user can set this option . Because of that , Libraries that can be loaded in this way are strictly limited to the installed standard libraries Directory plugins Shared libraries under subdirectories ( Guarantee only “ Safe ” The library is installed in This is the responsibility of the database administrator ).local_preload_libraries
Items in can be explicitly Specify this directory , for example $libdir/plugins/mylib
, Or just specify the Library name — mylib and $libdir/plugins/mylib
The effect is the same .
The purpose of this feature is to allow non privileged users to load the debugging or performance measurement Library in a specific session , Without an explicit LOAD command . For this purpose , Usually through the use of customers Client side PGOPTIONS Environment variables or ALTER ROLE SET To set this parameter .
however , Unless a module is specifically designed to be used by non super users in this way , This setting is generally not recommended . We should see session_preload_libraries
.
session_preload_libraries (string)
This variable specifies one or more shared libraries to be preloaded at the beginning of the connection . Only super users can change this setting . It contains a comma separated list of library names , For each of these names, press LOAD Command mode parsing . Spaces between items are ignored , If you need to include spaces or commas in the library name , Please put the library name in double quotation marks . This parameter only takes effect at the beginning of the connection . Subsequent changes have no effect . If the specified library is not found , The connection attempt will fail . Only super users can change this setting .
The intention of this feature is to allow libraries for debugging or performance measurement to be loaded in a specific session , There is no need to give an explicit LOAD command . for example , By using ALTER ROLE SET Setting this parameter can Enable... For all sessions under a given user name auto_explain
. also , No need to restart The server can change this parameter ( But it will take effect only when a new session is started ), In this way, it is easier to increase Add new modules , Even if they apply to all sessions .
and shared_preload_libraries
Different , Compared with being used for the first time in the Library Load it when , There is no performance advantage in loading at the beginning of a session . however , There are still some advantages when using connection pooling .
shared_preload_libraries (string)
This variable specifies one or more shared libraries to be preloaded at server startup . It contains a comma separated list of library names , For each of these names, press LOAD Command mode parsing . Spaces between items are ignored , If you need to include spaces or commas in the library name , Please put the library name in double quotation marks . This parameter can only be set when the server is started . If the specified library is not found , The server will not start .
Some libraries need to be executed only in postmaster Specific actions that occur at startup , For example, allocate shared memory 、 Keep the lightweight lock Or start the background workers . These libraries must be loaded at server startup through this parameter . See the documentation for details of each library .
Other libraries can also be preloaded . By preloading a shared library , When the library is used for the first time, the startup time of the library can be avoided . however , The time to start each new server process may increase slightly , Even if the process never uses the Library . therefore , Only Use this parameter for libraries that will be used in most sessions . also , Changing this parameter requires restarting the server , therefore This is not a good choice for short-term debugging tasks , We should switch to session_preload_libraries
.
stay Windows On a host , Preloading a library at server startup does not reduce the amount of time required to start each new server process Time ; Each server process will reload the preloaded library . however , For those who want to be in postmaster Startup time For libraries that perform operations ,Windows Host computer shared_preload_libraries Still useful .
jit_provider (string)
This variable is to be used JIT The name of the provider Library ( see Section 32.4.2). The default is llvmjit. This parameter can only be set when the server is started .
If this variable is set to a nonexistent Library ,JIT Will not be available , But there will be no mistakes . This feature allows you to PostgreSQL Install separately from the package JIT Support .
19.11.4. Other defaults
dynamic_library_path (string)
If you need to open a module that can be loaded dynamically and in CREATE FUNCTION or LOAD The file name specified in the command has no directory Part ( That is, the name does not contain slashes ), Then the system will search this path to find the required files .
dynamic_library_path
The value of must be colon separated ( Or in Windows Separated by semicolons ) List of absolute directory paths . If a list element starts with a special string ,$libdir
Will be replaced with PostgreSQL The compiled Library Directory in the package . Here is PostgreSQL Release the location where the provided module is installed ( Use pg_config --pkglibdir To find the name of this directory ). for example :
dynamic_library_path = '/usr/local/lib/postgresql:/home/my_project/lib: $libdir'
- 1.
Or in Windows Environment :
dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
- 1.
The default value for this parameter is ’$libdir’. If the value is set to an empty string , Then turn off automatic path search .
This parameter can be modified by the super user at runtime , However, such modified settings can only be maintained until the end of the client connection , Therefore, this method should be reserved for development purposes . We suggest that postgresql.conf Set this parameter in the configuration file .
gin_fuzzy_search_limit (integer)
GIN The soft upper limit of the set size returned by the index . See Section 66.5.
边栏推荐
- Database performance optimization tool
- 【海浪建模2】三维海浪建模以及海浪发电机建模matlab仿真
- User login function: simple but difficult
- Basic operations of database and table ----- create index
- Single step debugging of master data reading of SAP commerce cloud products
- MongoDB系列之学习笔记教程汇总
- Safety learning week4
- The difference between string STR and new string
- Are you still writing the TS type code
- Behind the cluster listing, to what extent is the Chinese restaurant chain "rolled"?
猜你喜欢
[wave modeling 2] three dimensional wave modeling and wave generator modeling matlab simulation
Operator explanation
【海浪建模3】三维随机真实海浪建模以及海浪发电机建模matlab仿真
Pandora IOT development board learning (RT thread) - Experiment 4 buzzer + motor experiment [key external interrupt] (learning notes)
Innovation leads the direction. Huawei Smart Life launches new products in the whole scene
Basic operation of database and table ----- the concept of index
Analysis and comparison of leetcode weekly race + acwing weekly race (t4/t3)
Complete knapsack problem (template)
What if the programmer's SQL data script coding ability is weak and Bi can't do it?
Inventory of more than 17 typical security incidents in January 2022
随机推荐
[FPGA tutorial case 10] design and implementation of complex multiplier based on Verilog
测试部新来了个00后卷王,上了年纪的我真的干不过了,已经...
npm install报错 强制安装
Several simplified forms of lambda expression
Parameter passing mechanism of member methods
Discrete mathematics: Main Normal Form (main disjunctive normal form, main conjunctive normal form)
Chia Tai International Futures: what is the master account and how to open it?
小程序直播 + 电商,想做新零售电商就用它吧!
Check if this is null - checking if this is null
全网最全正则实战指南,拿走不谢
【海浪建模3】三维随机真实海浪建模以及海浪发电机建模matlab仿真
Insert sort of sort
The difference between string STR and new string
FEG founder rox:smartdefi will be the benchmark of the entire decentralized financial market
Are you still writing the TS type code
I was beaten by the interviewer because I didn't understand the sorting
抓包整理外篇——————状态栏[ 四]
多模输入事件分发机制详解
Safety learning week4
Expansion operator: the family is so separated