Small knowledge, big challenge! This article is participating in the “Essential Tips for Programmers” creation campaign. This article also participated in the “Digitalstar Project” to win the creation package and challenge the creation incentive money. We studied and learned how to set the postgresql.conf parameter with reference to ali Cloud best practices and the official PostgresQL manual. (Only the parameters that need to be modified are listed below. Those whose default values are appropriate are not listed.)

System Environment Settings

datestyle = 'iso, mdy'
timezone = 'Asia/Shanghai'
lc_messages = 'en_US.utf8'     
lc_monetary = 'en_US.utf8'     
lc_numeric = 'en_US.utf8'      
lc_time = 'en_US.utf8'         
default_text_search_config = 'pg_catalog.english'
Copy the code

Datestyle: Sets the display format for date and time values, and rules for interpreting ambiguous date input values. For historical reasons, this variable contains two separate parts: the output format declaration (ISO, Postgres, SQL, or German), and the year/month/day order of the input/output (DMY, MDY, or YMD). These can be set separately or together. The keywords Euro and European are synonyms for DMY; The keywords US, NonEuro, and NonEuropean are synonyms for MDY. The built-in default is ISO, MDY, but initDB will initialize the configuration file with Settings corresponding to the behavior of the selected LC_time region. Timezone: sets the timezone used to display and interpret the timestamp. The built-in default is GMT, but this is usually overridden in postgresql.conf; Initdb will install a setting corresponding to its system environment. Lc_messages: Sets the message display language. The acceptable value is system dependent, and if the variable is set to an empty string (the default), the value is inherited from the server’s execution environment in a system dependent manner. On some systems, this regional classification does not exist. You can still set this variable, but it doesn’t have any effect. Likewise, translation messages for the desired language may not exist. In this case, you will still continue to see messages in English. Only superusers can change this setting. Because it affects both the messages sent to the server log and the client. An incorrect value can reduce the readability of the server logs. Lc_monetary: Sets the area used to format the amount of money, for example with the to_char family of functions. The acceptable value is system dependent, and if the variable is set to an empty string (the default), the value is inherited from the server’s execution environment in a system dependent manner. Lc_numeric: Sets the locale used to format numbers, for example with the to_char family of functions. The acceptable value is system dependent, and if the variable is set to an empty string (the default), the value is inherited from the server’s execution environment in a system dependent manner. Lc_time: Sets the area used to format the date and time, for example with the to_char family of functions. The acceptable value is system dependent, and if the variable is set to an empty string (the default), the value is inherited from the server’s execution environment in a system dependent manner. Default_text_search_config: Select the text search configuration used by those variants of the text search function that have no explicit parameter specified. The built-in default is pg_catalog.simple, but initDB initializes the configuration file with the Settings corresponding to the selected LC_cTYPE region if it can identify the configuration of a matching region.