3.4. ÔËÐÐʱÅäÖÃ

ÓÐÒ»¶ÑÅäÖòÎÊý¿ÉÒÔÓ°ÏìÊý¾Ý¿âϵͳµÄÐÐΪ£® ÎÒÃÇÔÚÕâÀïÃèÊöÒ»ÏÂÈçºÎÉèÖÃËüÃÇ£¬È»ºóÔÚÏÂÒ»ÕÂÎÒÃǽ«Öð¸ö ÌÖÂÛËüÃÇ£®

ËùÓвÎÊýÃû¶¼ÊÇ´óСд²»Ãô¸ÐµÄ£®Ã¿¸ö²ÎÊý¶¼¿ÉÒÔ½ÓÊÜËÄÖÖÀàÐÍÖ®Ò»¡Ã²¼¶û£¬ ÕûÊý£¬ ¸¡µãÊý£¬×Ö·û´®£®²¼¶ûÖµ¿ÉÒÔÊÇ ON£¬OFF£¬ TRUE£¬FALSE£¬ YES£¬NO£¬ 1£¬0 £¨´óСдÎ޹أ©»òÕâЩ¶«Î÷µÄÈÎÒâÇåÎúÎÞ ÆçÒåµÄǰ׺£®

ÉèÖÃÕâЩѡÏîµÄÒ»¸ö·½·¨ÊÇÔÚÊý¾ÝĿ¼Àï±ÈÈç £¨ÔÚÄÇÀï°²×°×ÅÒ»¸öȱʡÎļþ£© ´´½¨Ò»¸öÎļþ postgresql.conf ±ÈÈ磬ÏÂÃæÊÇÒ»¸ö¸ÃÎļþµÄÀý×Ó£º

# This is a comment
log_connections = yes
syslog = 2

ÏóÄã¿´µ½µÄÄÇÑù£¬Ñ¡ÏîÊÇÿÌõÒ»ÐУ®Ñ¡ÏîÃûºÍÖµÖ®¼äµÄµÈºÅÊÇ¿ÉÑ¡µÄ£® ¿Õ°×ºÍ¿ÕÐб»ºöÂÔ£®¾®ºÅ£¨"#"£©ÓÃ×öÈκεط½ ÒýÈë×¢ÊÍ£®

ÿ´Î postmaster ÊÕµ½SIGHUP(×î¼òµ¥µÄ·¢ËÍ·½·¨¾ÍÊÇ Ê¹Óà pg_ctl reload)£® Ðźź󶼻áÖØжÁÈ¡Õâ¸öÅäÖÃÎļþ£® postmaster ͬʱҲ½«Õâ¸öÐźŹ㲥¸øËùÓÐÕýÔÚÔËÐеĺó¶Ë½ø³ÌÕâÑùÏÖÓÐ »á»°Ò²Äܵõ½ÐµÄȱʡ£®ÁíÍ⣬Äã¿ÉÒÔÖ»ÏòÒ»¸öºó¶Ë½ø³ÌÖ±½Ó·¢ËÍÐźţ®

µÚ¶þÖÖÉèÖÃÕâЩÅäÖòÎÊýµÄ·½·¨ÊÇ°ÑËüÃÇ×÷ΪÃüÁîÐвÎÊý´«µÝ¸ø postmaster£¬ ±ÈÈç

postmaster -c log_connections=yes -c syslog=2

ÕâÑùºÍÉÏÃæµÄÀý×ÓÓÐͬÑùЧ¹û£® ÃüÁîÐÐÑ¡Ï¸ÇÈκÎÓë postgresql.conf ³åÍ»µÄÑ¡Ï

ÓÐʱºò£¬¸øijһ¸öÌض¨ºó¶Ë»á»°Ò»¸öÃüÁîÐвÎÊýÒ²ÊǺÜÓÐÓõģ® ¿ÉÒÔÔÚ¿Í»§¶ËʹÓû·¾³±äÁ¿ PGOPTIONS À´ÊµÏÖ Õâ¸öÄ¿µÄ£º

env PGOPTIONS='-c geqo=off' psql

£¨Õâ¸öÑ¡Ïî¿ÉÒÔÓÃÓÚÈκλùÓÚlibpqµÄ¿Í»§¶ËÓ¦Ó㬲»¹âÊÇ psql£®£©Çë×¢Ò⣬Õâ¸ö±äÁ¿¶ÔÄÇЩÐèÒªÔÚ ·þÎñÆ÷Æô¶¯ºó¹Ì¶¨µÄÑ¡ÏîÊÇÎÞЧµÄ£¬±ÈÈç¶Ë¿ÚºÅ£®

һЩѡÏî¿ÉÒÔÓà SET ÔÚ¶ÀÁ¢µÄ SQL »á»°ÖÐÐ޸ģ¬ ±ÈÈç¡Ã

=> SET ENABLE_SEQSCAN TO OFF;

Çë²Î¿¼ SQL ÃüÁîÓïÑÔÊÖ²á»ñÈ¡ÃüÁîÓï·¨µÄÏêϸÐÅÏ¢£® ÁíÍ⣬ÎÒÃÇ¿ÉÒÔ½«Ò»¸öÑ¡Ï¸³ÓèÒ»¸öÓû§»òÕßÊý¾Ý¿â£®ÔÚÒ»¸ö»á»°¿ªÊ¼µÄ ʱºò£¬Îª¸ÃÓû§ºÍÉæ¼°µÄÊý¾Ý¿â×°ÔØȱʡÉèÖã®ÃüÁî ALTER DATABASE ºÍ ALTER USER ·Ö±ðÓÃÓÚÅäÖÃÕâЩ¶«Î÷£®

3.4.1. pg_settings

Ðé±í pg_settings ÔÊÐíÏÔʾºÍ¸üе±Ç°»á»°µÄÔËÐÐʱ²ÎÊý¡£ SHOW ALL ÌṩµÄÿ¸ö¿ÉÓòÎÊý¶¼ÓÐÒ»Ìõ¼Ç¼¡£µ«ÊÇËüÃdzöÏÖµÄ ÐÎʽÊÇÔÊÐíËüÃÇÓëÆäËü¹ØϵÁ¬½Ó²¢ÇÒÊ©¼ÓÒ»¸öÑ¡Ôñ±ê×¼¡£

Ò»¸öÔÚ pg_settings ÉÏÖ´ÐÐµÄ UPDATE µÈЧÓÚÔÚÄǸöÃüÃû²ÎÊýÉÏÖ´ÐÐ SET ÃüÁî¡£ ÕâÑùµÄÐÞ¸ÄÖ»Ó°Ï쵱ǰ»á»°Ê¹ÓõÄÊýÖµ¡£Èç¹ûÔÚÒ»¸öÊÂÎñÀï·¢³öÁËÒ»¸ö UPDATE È»ºó¸ÃÊÂÎñºóÃæÍ˳öÁË£¬ÄÇô UPDATE ÃüÁîµÄЧ¹ûÔÚÊÂÎñ »Ø¹öµÄʱºòÏûʧ¡£Ò»µ©ÖÜΧµÄÊÂÎñÌá½»£¬ÄÇôÆäЧ¹û½²³ÖÐøµ½»á»°½áÊø£¬ ³ý·Ç±»ÆäËü UPDATE »òÕß SET ¸²¸Ç¡£

Table 3-1. pg_settings ×Ö¶Î

Ãû×ÖÀàÐÍÃèÊö
nametextµ±Ç°»á»°ÔËÐÐʱ²ÎÊýµÄÃû×Ö
settingtextµ±Ç°»á»°ÔËÐÐʱ²ÎÊýµÄÖµ

3.4.2. ¹æ»®Æ÷ºÍÓÅ»¯Æ÷µ÷½Ú

CPU_INDEX_TUPLE_COST(¸¡µãÊý)

ÉèÖÃÔÚÒ»´ÎË÷ÒýɨÃèÖÐÓÅ»¯Æ÷¼ÆËã³öÀ´µÄ´¦ÀíÿÌõË÷ÒýÔª×éµÄ¿ªÏú£® ÕâÊÇÒÔÒ»´Î˳ÐòÒ³ÃæץȡµÄ¿ªÏúµÄ·ÖÊýÀ´¼ÆÁ¿µÄ£®

CPU_OPERATOR_COST (¸¡µãÊý)

ÉèÖÃÓÅ»¯Æ÷¼ÆËã³öÀ´µÄ´¦ÀíÒ»ÌõWHERE×Ó¾äÖеÄÿ¸ö²Ù×÷·ûµÄ¿ªÏú£® ÕâÊÇÒÔÒ»´Î˳ÐòÒ³ÃæץȡµÄ¿ªÏúµÄ·ÖÊýÀ´¼ÆÁ¿µÄ£®

CPU_TUPLE_COST(¸¡µãÊý)

ÉèÖÃÓÅ»¯Æ÷Ô¤¼ÆÔÚÒ»´Î²éѯÖд¦ÀíÿÌõÔª×éµÄ¿ªÏú£® ÕâÊÇÒÔÒ»´Î˳ÐòÒ³ÃæץȡµÄ¿ªÏúµÄ·ÖÊýÀ´¼ÆÁ¿µÄ£®

DEFAULT_STATISTICS_TARGET (integer)

ΪûÓÐͨ¹ý ALTER TABLE SET STATISTICS ÉèÖÃÒ»¸ö×Ö¶ÎÏà¹Ø µÄÄ¿±êµÄ±í×Ö¶ÎÉèÖÃȱʡͳ¼ÆÄ¿±ê¡£¸ü´óµÄÊýÖµÔö¼ÓÁË ANALYZE ËùÐèÒªµÄʱ¼ä£¬µ«ÊÇ¿ÉÄÜ»á¸ÄÉƹ滮Æ÷µÄ¹À¼ÆÖÊÁ¿¡£È±Ê¡ÖµÊÇ 10¡£

EFFECTIVE_CACHE_SIZE(¸¡µãÊý)

ÉèÖÃÓÅ»¯Æ÷¼ÙÉèµÄ´ÅÅÌ»º³åµÄÓÐЧ³ß´ç£¨Äں˵ĴÅÅÌ»º³åÖн«±» PostgreSQLÊý¾ÝÎļþʹÓõıÈÀý£©£® ÕâÊÇÒÔ´ÅÅÌÒ³Ãæ¼ÆÁ¿µÄ£¬Í¨³£ÊÇ 8 kB/Ò³£®

ENABLE_HASHAGG (boolean)

´ò¿ª»ò¹Ø±Õ²éѯ¹æ»®Æ÷ÊÇ·ñʹÓÃÉ¢Áеľۼ¯¹æ»®ÀàÐÍ¡£È±Ê¡ÊÇ´ò¿ª¡£ Õâ¸ö¶«Î÷¿ÉÒÔÓÃÓÚµ÷ÊÔ²éѯ¹æ»®Æ÷¡£

ENABLE_HASHJOIN(²¼¶ûÊý)

ÔÊÐí»ò½ûÖ¹²éѯ¹æ»®Æ÷ʹÓÃÉ¢ÁÐÁ¬½Ó£¨ hash-join £©¹æ»®ÀàÐÍ£® ȱʡÊÇÔÊÐí£®Õâ¸öÑ¡ÏîÖ÷ÒªÓÃÓÚµ÷ÊÔ²éѯ¹æ»®Æ÷£®

ENABLE_INDEXSCAN (²¼¶ûÊý)

ÔÊÐí»ò½ûÖ¹²éѯ¹æ»®Æ÷ʹÓÃË÷ÒýɨÃè¹æ»®ÀàÐÍ£® ȱʡÊÇÔÊÐí£®Õâ¸öÑ¡ÏîÖ÷ÒªÓÃÓÚµ÷ÊÔ²éѯ¹æ»®Æ÷£®

ENABLE_MERGEJOIN (²¼¶ûÊý)

ÔÊÐí»ò½ûÖ¹²éѯ¹æ»®Æ÷ʹÓÃÈÚºÏÁ¬½Ó¹æ»®ÀàÐÍ£® ȱʡÊÇÔÊÐí£®Õâ¸öÑ¡ÏîÖ÷ÒªÓÃÓÚµ÷ÊÔ²éѯ¹æ»®Æ÷£®

ENABLE_NESTLOOP (²¼¶ûÊý)

ÔÊÐí»ò½ûÖ¹²éѯ¹æ»®Æ÷ʹÓÃǶÌ×Ñ­»·Á¬½Ó¹æ»®£® ʵ¼ÊÉϲ»¿ÉÄÜÍêÈ«½ûֹʹÓÃǶÌ×Ñ­»·Á¬½Ó£¬²»¹ý°ÑÕâ¸öÑ¡ÏîÉèÖÃΪ ½ûÖ¹»áÁîÓÅ»¯Æ÷ÔÚ´æÔÚÆäËü·½·¨µÄÇé¿öÏÂÓÅÏÈÑ¡ÓÃÆäËü·½·¨£® ȱʡÊÇÔÊÐí£®Õâ¸öÑ¡Ïî¶Ôµ÷ÊÔ²éѯ¹æ»®Æ÷ºÜÓÐÓã®

ENABLE_SEQSCAN(²¼¶ûÊý)

ÔÊÐí»ò½ûÖ¹²éѯ¹æ»®Æ÷ʹÓÃ˳ÐòɨÃè¹æ»®ÀàÐÍ£® ʵ¼ÊÉϲ»¿ÉÄÜÍêÈ«½ûÖ¹¹æ»®Æ÷ʹÓÃ˳ÐòɨÃ裬²»¹ý°ÑÕâ¸öÑ¡ÏîÉèÖÃΪ ½ûÖ¹»áÁîÓÅ»¯Æ÷ÔÚ´æÔÚÆäËü·½·¨µÄÇé¿öÏÂÓÅÏÈÑ¡ÓÃÆäËü·½·¨£® ȱʡÊÇÔÊÐí£®Õâ¸öÑ¡ÏîÖ÷ÒªÓÃÓÚµ÷ÊÔ²éѯ¹æ»®Æ÷£®

ENABLE_SORT(²¼¶ûÊý)

ÔÊÐí»ò½ûÖ¹²éѯ¹æ»®Æ÷ʹÓÃÃ÷È·µÄÅÅÐò²½Ö裮 ʵ¼ÊÉϲ»¿ÉÄÜÍêÈ«½ûÖ¹¹æ»®Æ÷ʹÓÃÅÅÐò£¬²»¹ý°ÑÕâ¸öÑ¡ÏîÉèÖÃΪ ½ûÖ¹»áÁîÓÅ»¯Æ÷ÔÚ´æÔÚÆäËü·½·¨µÄÇé¿öÏÂÓÅÏÈÑ¡ÓÃÆäËü·½·¨£® ȱʡÊÇÔÊÐí£®Õâ¸öÑ¡ÏîÖ÷ÒªÓÃÓÚµ÷ÊÔ²éѯ¹æ»®Æ÷£®

ENABLE_TIDSCAN(²¼¶û)

ÔÊÐí»ò½ûÖ¹²éѯ¹æ»®Æ÷ʹÓÃTIDɨÃè¹æ»®ÀàÐÍ£® ȱʡÊÇÔÊÐí£®Õâ¸öÑ¡ÏîÖ÷ÒªÓÃÓÚµ÷ÊÔ²éѯ¹æ»®Æ÷£®

GEQO£¨²¼¶û£©

ÔÊÐí»ò½ûÖ¹»ùÒò²éѯÓÅ»¯£¬ÕâÊÇÒ»ÖÖÊÔͼ²»Í¨¹ýÇî¾ÙËÑË÷À´ÊµÏÖ ²éѯ¹æ»®µÄËã·¨£®È±Ê¡ÊÇÔÊÐí£®²ÎÔĸ÷ÖÖÆäËûGEQO_ÉèÖã®

GEQO_EFFORT£¨ÕûÊý£©
GEQO_GENERATIONS£¨ÕûÊý£©
GEQO_POOL_SIZE£¨ÕûÊý£©
GEQO_RANDOM_SEED£¨ÕûÊý£©
GEQO_SELECTION_BIAS£¨¸¡µãÊý£©

¸÷ÖÖ¸÷ÑùµÄµ÷½Ú»ùÒò²éѯÓÅ»¯µÄ²ÎÊý£º »º³å³Ø´óС£¨pool size£©ÊÇÒ»¸öÈ«ÌåÖеĸöÌåµÄÊýÁ¿£®ÓÐЧֵ½éÓÚ 128 ºÍ 1024 Ö®¼ä£®Èç¹û°ÑËüÉèÖÃΪ 0£¨È±Ê¡£©£¬ÄÇô¾ÍʹÓà 2^(QS+1) ´óСµÄ»º³å³Ø£¬ÕâÀï QS ÊDzéѯÖйØϵµÄÊýÁ¿£®Ó°Ï죨effort£©ÓÃÓÚΪÿһ´ú ¼ÆËãÒ»¸öȱʡֵ£®ÓÐЧֵÊǽéÓÚ 1 ºÍ 80 Ö®¼äµÄÊý×Ö£¬40 ÊÇȱʡֵ£® ´ú£¨Generations£©ÉùÃ÷Ëã·¨Öеķ´¸´´ÎÊý£®´ËÊý×Ö±ØÐëÊÇÕýÕûÊý£® Èç¹ûÉùÃ÷ÁË 0£¬ÄÇô¾ÍʹÓà Effort * Log2(PoolSize)£®´ËËã·¨µÄÔËÐРʱ¼ä´ó¸ÅÊÇ»º³å³Ø´óС£¨pool size£©ºÍ´ú£¨Generations£©Ö®ºÍµÄ·ÖÊý£® Ñ¡ÔñÆ«ÒÆ£¨selection bias£©ÊÇÈ«ÌåÄÚ²¿µÄÑ¡ÔñÐÔѹÁ¦ £¨selective pressure£©£® ÆäÖµ¿ÉÒÔ½éÓÚ 1.50 µ½ 2.00 Ö®¼ä£»ºóÕßÊÇȱʡ£® Ëæ»úÖÖ×Ó¿ÉÒÔÉèÖÃΪÈÃÕâ¸öËã·¨±íÏÖΪÄܹ»²úÉú¿É¸´ÏÖµÄÖµ£®Èç¹û°Ñ ËüÉèÖÃΪ -1 ÄÇô´ËËã·¨µÄÐÐΪ½«²»¿ÉÅж¨£®

GEQO_THRESHOLD£¨ÕûÊý£©

Ö»Óе±Éæ¼°µÄFROM¹ØϵÊýÁ¿ÖÁÉÙÓÐ GEQO_THRESHOLD ¸öʱ£¬ ²ÅʹÓûùÒò²éѯÓÅ»¯£® £¨Çë×¢ÒâÒ»¸öJOIN¹¹ÔìÖ»Ëã×öÒ»¸öFROMÏ£© ȱʡÊÇ 11£¬¶ÔÓÚÊýÁ¿Ð¡ÓÚ´ËÊýµÄ²éѯ£¬Ò²ÐíʹÓÃÅж¨ÐÔµÄÇî¾ÙËÑË÷¸üÓÐЧ£® Õâ¸ö²ÎÊýÒ²¿ØÖÆÓÅ»¯Æ÷ÔÚ°Ñ×Ó²éѯµÄ FROM ×Ó¾äÈںϵ½ Éϲã²éѯµÄʱºòµ½µ×ʹ¶à´óµÄ¾¢£®

RANDOM_PAGE_COST£¨¸¡µãÊý£©

ÉèÖÃÓÅ»¯Æ÷¼ÆËãµÄÒ»´Î·Ç˳Ðò´ÅÅÌÒ³ÃæץȡµÄ¿ªÏú£® ÕâÊÇÒÔ˳Ðò´ÅÅÌÒ³ÃæץȡµÄ¿ªÏúµÄ±¶Êý¼ÆÁ¿µÄ£® ¸ü¸ßµÄÊýÖµÁîÓÅ»¯Æ÷¸üÇãÏòÓÚÑ¡ÔñÒ»´Î˳ÐòɨÃ裬µÍÊýÖµµÄʱºò ÔòÇãÏòÓÚʹÓÃË÷ÒýɨÃè¡£

×¢Òâ: Ôã¸âµÄÊÇ£¬ÎÒÃÇûÓкܺõĶ¨ÒåÎÒÃÇÉÏÃæ¸Õ¸ÕÃèÊöÍêµÄ "COST£¨¿ªÏú£©" ¼Ò×åµÄµäÐÍÖµµÄ·½·¨£®ÎÒÃǹÄÀøÄã×Ô¼ºÊÔÑé²¢ÇÒÓëÎÒÃǹ²ÏíÄãµÄ·¢ÏÖ£®

3.4.3. ÈÕÖ¾ºÍµ÷ÊÔ

CLIENT_MIN_MESSAGES (string)

Õâ¸öÑ¡Ïî¿ØÖÆдÈë·þÎñÆ÷ÈÕÖ¾µÄÏêϸ³Ì¶È£® ÓÐЧµÄÊýÖµÊÇ DEBUG5£¬DEBUG4£¬ DEBUG3£¬DEBUG2£¬ DEBUG1£¬INFO£¬NOTICE£¬ DEBUG1, INFO, NOTICE, WARNING, ERROR£¬LOG£¬ FATAL£¬ºÍ PANIC£®Ô½¿¿ºóµÄÊýÖµ·¢Ë͵½ÈÕÖ¾µÄϸ½ÚÔ½ÉÙ£® ȱʡÊÇ NOTICE£® ÕâÀïµÄ LOG ºÍ LOG_MIN_MESSAGES ÀïÃæµÄÓв»Í¬µÄÓÅÏȼ¶£®

ÕâÀïÊǸ÷ÖÖÐÅÏ¢ÀàÐ͵ÄÒ»¸öÕªÒª£º

DEBUG[1-5]

Õâ¸öÌṩ¿ª·¢ÈËԱʹÓõÄÐÅÏ¢¡£

INFO

Õâ¸öÌṩÓû§Òþº¬ÒªÇóµÄÐÅÏ¢£¬±ÈÈçÔÚ VACUUM VERBOSE ¹ý³ÌÖеÄÐÅÏ¢¡£

NOTICE

Õâ¸öÌṩ¿ÉÄܶÔÓû§ÓаïÖúµÄÐÅÏ¢£¬±ÈÈ磬³¤±êʶ·ûµÄ½Ø¶Ï£¬ ×÷ΪÖ÷¼üÒ»²¿·Ö´´½¨µÄË÷Òý¡£

WARNING

Õâ¸öÌṩ¸øÓû§µÄ¾¯¸æ£¬±ÈÈçÔÚÊÂÎñ·¶Î§Ö®ÍâµÄ COMMIT¡£

ERROR

±¨¸æµ¼ÖÂÊÂÎñÍ˳öµÄ´íÎó¡£

LOG

Õâ¸ö±¨¸æһЩ¹ÜÀíÔ±¸ÐÐËȤµÄÐÅÏ¢£¬±ÈÈ磬¼ì²éµã»îÔ¾ÐÔ¡£

FATAL

Õâ¸ö±¨¸æΪʲôºó¶Ë»á»°ÖÕÖ¹¡£

PANIC

Õâ¸ö±¨¸æΪʲôËùÓкó¶ËÖØÆô¡£

DEBUG_ASSERTIONS£¨²¼¶û£©

´ò¿ª¸÷ÖÖ¶ÏÑÔ¼ì²é£®ÕâÊǵ÷ÊÔÖúÊÖ£®Èç¹ûÄã¾­ÀúÁËÆæ¹ÖµÄ벡»òÕß ±ÀÀ££¬¿ÉÄÜÄãÏ£Íû°ÑÕâ¸öÑ¡Ïî´ò¿ª£¬ÒòΪËü¿ÉÄܻᱩ¶³ÌÐòµÄ´íÎó£® ÒªÊ¹ÓÃÕâ¸öÑ¡ÏÖÆ×÷PostgreSQLµÄʱºò±ØÐ붨Òå USE_ASSERT_CHECKINGºê£® £¨ÊÇͨ¹ý configure Ñ¡Ïî --enable-cassertʵÏֵģ©£® Çë×¢ÒâÈç¹ûPostgreSQLÊÇ´ò¿ª¶ÏÑÔÖÆ×÷µÄ»°£¬ÄÇô DEBUG_ASSERTIONS ȱʡÊÇ´ò¿ªµÄ£®

DEBUG_PRINT_PARSE£¨²¼¶û£©
DEBUG_PRINT_REWRITTEN£¨²¼¶û£©
DEBUG_PRINT_PLAN£¨²¼¶û£©
DEBUG_PRETTY_PRINT£¨²¼¶û£©

¶ÔÓÚÈκÎÖ´ÐеIJéѯ£¬°Ñ¸Ã²éѯ£¬ËüÉú³ÉµÄ·ÖÎöÊ÷£¬ËüÉú³ÉµÄÖ´Ðй滮£¬»òÕßÆä ²éѯÖØдÊä³ö´òÓ¡µ½·þÎñÆ÷ÈÕÖ¾ÖУ® Ñ¡Ôñ DEBUG_PRETTY_PRINT »áÉú³ÉƯÁÁЩµ«Êdz¤Ò»Ð©µÄÊä³ö¸ñʽ£®

EXPLAIN_PRETTY_PRINT (boolean)

ÅÐ¶Ï EXPLAIN VERBOSE ÊÇʹÓÃËõ½ø¸ñʽ»¹ÊÇʹÓ÷ÇËõ½ø ¸ñʽÓÃÓÚÏÔʾÏêϸµÄ²éѯÊ÷ת´¢£®

LOG_HOSTNAME£¨²¼¶û£©

ȱʡʱ£¬Áª½ÓÈÕÖ¾Ö»¼Ç¼ËùÁª½ÓÖ÷»úµÄ IP µØÖ·£®Èç¹ûÄãÏëÏÔʾÖ÷»úÃû£¬ Äã¿ÉÒÔ´ò¿ªÕâ¸öÑ¡Ï²»¹ý£¬ÕâÑùÓпÉÄÜ´øÀ´Ò»Ð©²»¿ÉºöÂÔµÄÐÔÄÜËðʧ£¬ --È¡¾öÓÚÄãµÄÃû×Ö½âÎöµÄÉèÖã® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

LOG_CONNECTIONS£¨²¼¶û£©

ÕâÑù»áÔÚÿ´Î³É¹¦µÄÁª½ÓµÄʱºò¶¼Ïò·þÎñÆ÷ÈÕÖ¾Àï´òÓ¡Ò»ÐÐÐÅÏ¢£® ȱʡʱÊǹرյģ¬¾¡¹ÜËü¿ÉÄܺÜÓÐÓã®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖ㬠»òÕßÔÚ postgresql.conf ÅäÖÃÎļþÀïÉèÖã®

LOG_DURATION (boolean)

µ¼ÖÂÿ¸öÍê³ÉµÄÓï¾äµÄ³ÖÐøʱ¼ä¶¼Ð´ÈëÈÕÖ¾¡£ÒªÊ¹ÓÃÕâ¸öÑ¡Ï ´ò¿ª LOG_STATEMENT ºÍ LOG_PID£¬ ÕâÑùÄã¾Í¿ÉÒÔÓýø³Ì ID °ÑÓï¾äºÍ³ÖÐøʱ¼äÁ¬½ÓÆðÀ´¡£

LOG_MIN_ERROR_STATEMENT (string)

¿ØÖÆÊÇ·ñÔÚ·þÎñÆ÷ÈÕÖ¾ÀïÊä³öÄÇЩµ¼Ö´íÎóÌõ¼þµÄ SQL Óï¾ä¡£ ËùÓе¼ÖÂÒ»¸öÌض¨¼¶±ð£¨»òÕ߸ü¸ß¼¶±ð£©µÄ´íÎóµÄ SQL Óï¾ä¶¼Òª ±»¼Ç¼ÈÕÖ¾¡£ ȱʡÊÇ PANIC £¨Êµ¼ÊÉÏÊÇ°ÑÕâ¸öÌØÐԹرÕÁË£©¡£ÓÐЧµÄÖµÓÐ DEBUG5£¬ DEBUG4£¬DEBUG3£¬ DEBUG2£¬DEBUG1£¬ INFO£¬NOTICE£¬ WARNING£¬ERROR£¬ FATAL£¬ºÍ PANIC¡£ ±ÈÈ磬Èç¹ûÄã°ÑÕâ¸öÉèÖÃΪ ERROR£¬ ÄÇôËùÓе¼Ö´íÎó£¬ÖÂÃü´íÎ󣬻òÕß¿Ö»ÅµÄ SQL Óï¾ä¶¼½«±»¼Ç¼ÈÕÖ¾¡£ ´ò¿ªÕâ¸öÑ¡Ïî¿ÉÒÔ°ïÖú¸ú×ÙÄÇЩÔÚ·þÎñÆ÷ÈÕÖ¾Àï³öÏÖµÄÈκδíÎóµÄÔ´Í·¡£

ÎÒÃǽ¨ÒéÄãÒ²°É LOG_PID ´ò¿ª£¬ÕâÑùÄã¾Í¿ÉÒÔ¸ü ÈÝÒ×½²´íÎóÓï¾äºÍ´íÎóÐÅÏ¢¶ÔÓ¦ÆðÀ´¡£

LOG_MIN_MESSAGES (string)

¿ØÖÆдµ½·þÎñÆ÷ÈÕÖ¾ÀïµÄÐÅÏ¢µÄÏêϸ³Ì¶È¡£ÓÐЧֵÊÇ DEBUG5£¬ DEBUG4£¬DEBUG3£¬DEBUG2£¬ DEBUG1£¬INFO£¬NOTICE£¬ WARNING£¬ERROR£¬LOG£¬ FATAL£¬ºÍ PANIC¡£Ô½¿¿ºóµÄÊýÖµ·¢Íù·þÎñÆ÷ÈÕÖ¾ µÄÐÅÏ¢Ô½¼òµ¥¡£È±Ê¡ÊÇ NOTICE¡£Çë×¢Òâ LOG ºÍ CLIENT_MIN_MESSAGES ÀïÃæµÄͬÃû¼¶±ðÓÅÏȼ¶²»Í¬¡£ ÓÖ¼û¸Ã½Ú»ñÈ¡ÕâЩֵµÄ½âÊÍ¡£

LOG_PID£¨²¼¶û£

ÔÚÿÌõ·þÎñÆ÷ÐÅϢǰÃæ¼ÓÉϺó¶Ë·þÎñ½ø³ÌµÄ½ø³ÌºÅǰ׺£® Õâ¶ÔÀí³öijÌõÐÅÏ¢ÊôÓÚÄǸöÁª½ÓºÜÓаïÖú£® ȱʡʱÊǹرյģ® Õâ¸ö²ÎÊý²¢²»Ó°Ïìͨ¹ý syslog ¼Ç¼ÈÕÖ¾µÄÏûÏ¢£¬ Ëü×Ü°üº¬½ø³Ì ID¡£

LOG_STATEMENT (boolean)

¼Ç¼ÿ¸öµ½À´µÄ SQL ²éѯ¡£

LOG_DURATION (boolean)

´òӡÿ¸öÍê³ÉµÄ²éѯµÄ³ÖÐøʱ¼ä¡£ÒªÊ¹ÓÃÕâ¸öÑ¡Ï´ò¿ª LOG_STATEMENT ºÍ LOG_PID£¬ÕâÑùÄã¿ÉÒÔÓýø³ÌºÅÁ´½Ó³õµÄ²éѯºÍËüµÄ³ÖÐøʱ¼ä¡£

LOG_TIMESTAMP£¨²¼¶û£©

ÔÚÿÌõ·þÎñÆ÷ÐÅϢǰÃæ¼ÓÉÏʱ¼ä´Áǰ׺£® ȱʡʱÊǹرյģ®

LOG_STATEMENT_STATS£¨²¼¶û£©
LOG_PARSER_STATS£¨²¼¶û£©
LOG_PLANNER_STATS£¨²¼¶û£©
LOG_EXECUTOR_STATS£¨²¼¶û£©

¶ÔÿÌõ²éѯ£¬Ïò·þÎñÆ÷ÈÕÖ¾ÀïÊä³öÏàӦģ¿éµÄÐÔÄÜͳ¼Æ£® ÕâÊÇԭʼµÄµ÷½Ú¹¤¾ß£®

LOG_SOURCE_PORT£¨²¼¶û£©

ÔÚÁª½ÓÈÕÖ¾ÐÅÏ¢ÀïÃæÏÔʾÕýÔÚÁ¬½ÓµÄÖ÷»úµÄ¶Ë¿ÚºÅ£® Äã¿ÉÒÔ»ØË·´Ë¶Ë¿ÚºÅ²¢ÕÒ³öÊÇÄĸöÓû§³õʼ»¯µÄÁª½Ó£® ÒòΪÕâ¸ö¹¦ÄÜ»ù±¾Ã»Óã¬ËùÒÔȱʡÊǹرգ® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

STATS_COMMAND_STRING (boolean)
STATS_BLOCK_LEVEL (boolean)
STATS_ROW_LEVEL (boolean)

¾ö¶¨ºó¶Ë·¢Ë͸øͳ¼ÆÊÕ¼¯½ø³ÌµÄÐÅÏ¢¡Ãµ±Ç°ÃüÁ¿é²ã´ÎµÄ»îÔ¾ÐÔ Í³¼Æ»òÕßÐвã´ÎµÄ»îÔ¾ÐÔͳ¼Æ£®ËùÓеÄȱʡ¶¼ÊǹرÕ(off)£®´ò¿ªÍ³¼ÆÊÕ¼¯ »áµ¼ÖÂÿ¸ö²éѯ¶à¸¶³öÒ»µãµãʱ¼ä¿ªÏú£¬µ«ÊǶÔÓÚµ÷ÊÔºÍÐÔÄÜÓÅ»¯È·ÊÇÎ޼۵ģ®

STATS_RESET_ON_SERVER_START (boolean)

Èç¹û´ò¿ª£¬ÄÇôÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÊÕ¼¯µÄÐÅÏ¢±»ÇåÁ㣮 Èç¹û¹Ø±Õ£¬ÄÇôͳ¼ÆÔÚ·þÎñÆ÷ÖØÆð¹ý³ÌÖÐÀÛ¼Ó£®È±Ê¡ÊÇ´ò¿ª£® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

STATS_START_COLLECTOR (boolean)

¿ØÖÆ·þÎñÆ÷ÊÇ·ñÆô¶¯Í³¼ÆÊÕ¼¯×Ó½ø³Ì£®È±Ê¡Ê±ÊÇ´ò¿ª£¬ µ«Èç¹ûÄã¶Ôͳ¼ÆÊÕ¼¯²»¸ÐÐËȤ£¬ÄÇô¿ÉÒԹرգ®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚÆô¶¯·þÎñÆ÷ʱ ÉèÖã®

SYSLOG£¨ÕûÊý£©

PostgreSQL ÔÊÐí°Ñ syslog ×÷ΪÈÕ־ϵͳ£®Èç¹ûÕâ¸öÑ¡Ïî ÉèΪ 1£¬ÔòÐÅϢͬʱÍùsyslogºÍstdoutÊä³ö£®Èç¹ûÉèΪ 2£¬ ÔòÖ»Êä³öµ½syslog£ £¨ÓÐЩÐÅÏ¢»¹ÊÇ»áÊä³öµ½stdout/stderr£®£© ȱʡÊÇ 0£¬Òâζ׏رÕÏòsyslogµÄÊä³ö£® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

SYSLOG_FACILITY(×Ö´®)

Õâ¸öÑ¡ÏîÔÚ´ò¿ªsyslogºóÅжÏҪʹÓÃµÄ syslog "ÉèÊ©"£®Äã¿ÉÒÔ´Ó from LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7; ÖÐÑ¡Ôñ£»È±Ê¡ÊÇLOCAL0£®²ÎÔÄÄãµÄϵͳµÄ syslog£®

SYSLOG_IDENT(×Ö´®)

Èç¹û´ò¿ªÁËÏòsyslogÖмÇÈÕÖ¾µÄ¹¦ÄÜ£¬ Õâ¸öÑ¡Ïî¾ö¶¨ÓÃÓÚÔÚ syslog ÈÕÖ¾ÐÅÏ¢Öбêʶ PostgreSQL µÄ³ÌÐòÃû£®È±Ê¡ÊÇ postgres£®

TRACE_NOTIFY£¨²¼¶û£©

Ϊ LISTEN ºÍ NOTIFY ÃüÁîÉú³ÉÒ»´ó¶Ñµ÷ÊÔÊä³ö£®

3.4.4. Ò»°ã²Ù×÷

AUTOCOMMIT (bool)

Èç¹ûÉèÖÃΪÕ棬ÄÇô PostgreSQL »áÔÚÿ¸ö ûÓÐÃ÷È·ÔÚÒ»¸öÊÂÎñ¿éÀïÃ棨Ҳ¾ÍÊÇ˵£¬³ý·Ç¸ø³öÁËÒ»¸öûÓжÔÓ¦µÄ COMMIT µÄ BEGIN£©µÄ³É¹¦µÄÃüÁîºóÃæ×Ô¶¯×öÒ» ¸ö COMMIT¡£ Èç¹ûÉèÖÃΪ¼Ù£¬PostgreSQL ½«Ö»ÓÐÔÚÃ÷È· ÊÕµ½Ò»¸ö COMMIT ÃüÁîµÄʱºò²Å»áÌá½»±ä»¯¡£Õâ¸öģʽҲ¿ÉÒÔ µ±×÷ÊÇÔÚÊÕµ½Ò»¸öÃüÁîµØʱºòÃ÷È·µØ·¢³ö BEGIN£¬¶ø PostgreSQL Õâ¸öʱºò²¢Î´ÒѾ­ÔÚÒ»¸ö ÊÂÎñ¿éÀïÃ档ȱʡÊÇÕ棬ÕâÊÇΪÁ˼æÈÝÀúÊ·µØ PostgreSQL ÐÐΪ¡£ µ«ÊÇ£¬Èç¹ûÒª×î´óÏ޶ȵØÓë SQL ¹æ·¶¼æÈÝ£¬ÄÇô°ÑËüÉèΪ¼Ù¡£

×¢Òâ: ¼´Ê¹ autocommit ÉèÖÃΪ¼Ù£¬SET£¬ SHOW£¬ºÍ RESET Ò²²»»á¿ªÊ¼Ò»¸öÐ嵀 ÊÂÎñ¿é¡£ËûÃÇÔÚ×Ô¼ºµÄÊÂÎñÀïÔËÐС£Ò»µ©·¢³öÁËÁíÍâÒ»ÌõÃüÁ ¾Í¿ªÊ¼Ò»¸öÊÂÎñ¿é£¬²¢ÇÒÈκΠSET£¬SHOW£¬ »òÕß RESET ÃüÁ±»ÈÏΪÊǸÃÊÂÎñµÄÒ»²¿·Ö£¬Ò²¾ÍÊÇ˵£¬ ËûÃÇ»á¸ù¾ÝÊÂÎñµÄ״̬¶øÌá½»»òÕ߻عö¡£ÒªÔÚÊÂÎñ¿éµÄ¿ªÊ¼Ö´ÐÐÒ»¸ö SET£¬ SHOW£¬»òÕß RESET ÃüÁÏÈʹÓà BEGIN¡£

×¢Òâ: µ½ PostgreSQL 7.3£¬ÉèÖà autocommit Ϊ¼ÙÖ§³ÖµÃ²»ÊǺܺá£ÕâÊÇÒ»¸öÐÂÌØÐÔ£¬»¹Ã»ÓÐΪËùÓпͻ§¶Ë¿âºÍÓ¦ÓÃËùÏ°¹ß¡£ ÔÚ°ÑËü×÷ΪÄãµÄ°²×°µÄȱʡÉèÖÃ֮ǰ£¬ÇëÈÏÕæ²âÊÔ¡£

AUSTRALIAN_TIMEZONES (bool)

Èç¹ûÉèÖÃΪÕ棬ÄÇô CST£¬ EST£¬ºÍ SAT ¶¼½âÊÍ³É Australian ʱÇø£¬¶ø²»ÊDZ±ÃÀÖÐ/¶«²¿Ê±ÇøºÍÖÜÁù£®È±Ê¡ÊǼ٣®

AUTHENTICATION_TIMEOUT (integer)

Íê³É¿Í»§¶ËÈÏÖ¤µÄ×ʱ¼ä£¬ÒÔÃë¼Ç£®Èç¹ûÒ»¸ö×¼¿Í»§Î´ÄÜÔÚÕâ¸öʱ¼ä³¤¶ÈÄÚ Íê³ÉÈÏ֤ЭÒ飬ÄÇô·þÎñÆ÷½«×ÔÐÐÖжÏÁª½Ó£®ÕâÑù¾Í±ÜÃâÁ˹ÒÆðµÄ¿Í»§¶Ë ÎÞÏÞÖƵØÕ¼¾ÝÁª½Ó£®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÔÚ postgresql.conf ÎļþÀïÉèÖã®

CLIENT_ENCODING (string)

ÉèÖÿͻ§¶Ë±àÂ루×Ö·û¼¯£©¡£È±Ê¡Ê¹ÓÃÊý¾Ý¿â±àÂë¡£

DB_USER_NAMESPACE (boolean)

ÕâÑù¾ÍÔÊÐíÿÊý¾Ý¿âµØÓû§Ãû¡£È±Ê¡Êǹرա£

Èç¹û´ò¿ªËü£¬ÄÇô Äã¿ÉÒÔÏó username@dbname ÕâÑù´´½¨Óû§¡£Èç¹û¿Í»§¶Ë´«µÝ username ¹ýÀ´£¬ÄÇô@ ºÍÊý¾Ý¿âÃû±»¸½¼Óµ½Óû§ÃûºóÃ棬Ȼºó·þÎñÆ÷ʹÓÃÕâ¸öÊý¾Ý¿âÏà¹ØµÄÓû§Ãû½øÐвéÕÒ¡£ Èç¹û´´½¨Ò»¸ö°üº¬ @ µÄÓû§Ãû£¬ÄÇôÄãÐèÒª°ÑÓû§ÃûÒýÆðÀ´¡£

´ò¿ªÕâ¸öÑ¡ÏîÖ®ºó£¬Ä㻹ÊÇ¿ÉÒÔ´´½¨ÆÕͨµÄÈ«¾ÖÓû§¡£Ö»ÒªÔÚ¿Í»§¶ËÉùÃ÷ Óû§ÃûµÄʱºò¼òµ¥¸½¼Ó @¡£@ »á±»É¾³ý£¬ È»ºó·þÎñÆ÷²Å½øÐвéѯ¡£

×¢Òâ: Õâ¸öÌØÐÔÊÇÒ»¸öÁÙʱµÄÊÔÑéÌØÐÔ£¬Ö±µ½ÕÒ³öÒ»¸öÍêÕûµÄ½â¾ö·½°¸¡£ µ½ÄǸöʱºò£¬Õâ¸öÑ¡Ïî¿ÉÄܻᱻɾ³ý¡£

DEADLOCK_TIMEOUT£¨ÕûÊý£©

Õâ¸öÊÇÒÔºÁÃë¼ÆµÄʱ¼ä£¬ÓÃÓÚÉèÖÃÔÚ¼ì²éÊÇ·ñ´æÔÚËÀËøÌõ¼þ֮ǰµÄµÈ´ý ʱ¼ä£® ¼ì²éÊÇ·ñ´æÔÚËÀËøÌõ¼þÊÇÒ»¸ö»ºÂýµÄ¹ý³Ì£¬Òò´Ë·þÎñÆ÷²»»áÔÚÿ´Î µÈ´ýËøµÄʱºò¶¼ÔËÐÐÕâ¸ö¹ý³Ì£®ÎÒÃÇ£¨Àֹ۵أ¿£©¼ÙÉèÔÚÉú²úÓ¦ÓÃÖеÄËÀËø ÊDz»³£³öÏֵģ¬Òò´ËÎÒÃÇÔÚ¿ªÊ¼Ñ¯ÎÊÊÇ·ñ¿ÉÒÔ½âËø֮ǰֻµÈ´ýÒ»¸öËø Ïà¶Ô¶ÌµÄÒ»¶Îʱ¼ä£® Ôö¼ÓÕâ¸öÖµ¾Í¼õÉÙÁËÀË·ÑÔÚÎÞÓõÄËÀËø¼ì²éÉϵÄʱ¼ä£¬µ«ÊǼõÂýÁ˱¨¸æ ÕæÕýËÀËø´íÎóµÄËٶȣ® ȱʡÊÇ 1000£¨Ò²¾ÍÊÇ 1 Ã룩£¬¿ÉÄÜÊÇÄãÄܹ»ÄÍÐĵȴýµÄ×î¶Ìʱ¼ä£® ÔÚÒ»¸öÖØÔصķþÎñÆ÷ÉÏ£¬Äã¿ÉÄÜÐèÒªÔö´óËü£®Õâ¸öÖµµÄµäÐÍÉèÖÃÓ¦¸Ã ³¬¹ýÄãµÄÊÂÎñµÄʱ¼ä£¬ÕâÑù¾Í¿ÉÒÔ¼õÉÙÔÚËøÊÍ·Å֮ǰ¾Í¿ªÊ¼ËÀËø¼ì²éµÄ ÎÊÌ⣮ Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

DEFAUL_TRANSACTION_ISOLATION (×Ö´®)

ÿ¸ö SQL ÊÂÎñ¶¼ÓÐÒ»¸ö¸ôÀ뼶±ð£¬¿ÉÒÔÊÇ"¶ÁÒÑÌá½»" »òÕßÊÇ"¿É´®ÐÔ»¯"£®Õâ¸ö²ÎÊý¿ØÖÆÿ¸öеÄÊÂÎñµÄ ¸ôÀ뼶±ð£®È±Ê¡ÊǶÁÒÑÌá½»£®

²Î¿¼ PostgreSQL 7.3 Óû§ÊÖ²á ºÍÃüÁî SET TRANSACTION »ñÈ¡¸ü¶àÐÅÏ¢£®

DYNAMIC_LIBRARY_PATH (string)

Èç¹ûÐèÒª´ò¿ªÒ»¸ö¿ÉÒÔ¶¯Ì¬×°ÔصÄÄ£¿é²¢ÇÒÉùÃ÷µÄÃû×ÖûÓÐĿ¼ ²¿·Ö(Ò²¾ÍÊÇ˵Ãû×ÖÀï²»°üº¬Ð±¿¸)£¬ÄÇôϵͳ½«ËÑË÷Õâ¸öĿ¼ÒÔ ²éÕÒÉùÃ÷µÄÎļþ£®(ËùʹÓõÄÃû×Ö¾ÍÊÇÔÚ CREATE FUNCTION »òÕßLOAD ÃüÁîÖÐÉùÃ÷µÄÃû×Ö£®)

ÓÃÓÚ dynamic_library_path µÄÊýÖµ±ØÐëÊÇÒ»¸öðºÅ·Ö¸ôµÄ ¾ø¶Ô·¾¶Ãû×ÖÁÐ±í£®Èç¹ûÒ»¸ö·¾¶Ãû×ÖÒÔÌØÊâ±äÁ¿ '$libdir'£¬ PostgreSQL±àÒëºÃµÄ¿âĿ¼£¬¿ªÍ·£¬ ÄÇô¾ÍÌ滻ΪPostgreSQL·¢²¼ÌṩµÄÄ£¿é°²×°Â·¾¶£® ±ÈÈç¡Ã

dynamic_library_path = '/usr/local/lib:/home/my_project/lib:$libdir:$libdir/contrib'

ÓÃÓÚÕâ¸ö²ÎÊýµÄȱʡÊýÖµÊÇ $libdir£® Èç¹û¸ÃÊýÖµÉèÖÃΪ¿Õ×Ö´®£¬ÄÇô¾Í»á¹Ø±Õ×Ô¶¯Â·¾¶²éÕÒ£®

Õâ¸ö²ÎÊý¿ÉÒÔÔÚÔËÐÐʱÓɳ¬¼¶Óû§Ð޸ģ¬µ«ÊÇÕâÑùÉèÖÃµÄ ²ÎÊýÖ»³ÖÐøµ½¸Ã¿Í»§Áª½ÓµÄÖÕÖ¹£¬Òò´ËÕâ¸ö·½·¨Ó¦¸Ã±£Áô¸ø¿ª·¢ÓÃ;£® ÎÒÃÇÍƼöÔÚ postgresql.conf ÅäÖÃÎļþÀïÉèÖÃÕâ¸ö ²ÎÊý£®

FSYNC£¨²¼¶û£©

Èç¹ûÕâ¸öÑ¡Ïî´ò¿ª£¬PostgreSQLºó¶Ë¾Í»áÔÚÈô¸É¸ö λÖõ÷ÓÃfsync()ϵͳµ÷ÓÃÒÔ±£Ö¤¸üÐÂÎïÀíµØдÈë´ÅÅÌ£® ÕâÑù¾Í±£Ö¤ÁËÒ»¸öÊý¾Ý¿â°²×°¿ÉÒÔÔÚ²Ù×÷ϵͳ»òÕßÓ²¼þ±ÀÀ£Ö®ºó »Ö¸´µ½Ò»¸öÎȶ¨µÄ״̬£® ÕâÑù×ö¼«´óµØÔö¼ÓÁËÒ»¸öÊý¾Ý¿â°²×°ÔÚ¾­ÀúÁË´ó¹æÄ£µÄ²Ù×÷ϵͳ»òÓ²¼þ ±ÀÀ£ºóÈÔÈ»¿ÉÓõĻú»á£®£¨Êý¾Ý¿â·þÎñÆ÷µÄ±ÀÀ£²»»á ³öÏÖÕâ¸öÎÊÌ⣩£®

²»¹ý£¬Õâ¸ö²Ù×÷´ó´óµØ½µµÍÁË PostgreSQL µÄËٶȣ¬ÒòΪÊÂÎñÌá½»µÄʱºò£¬Ëü¶¼±ØÐë Í£ÏÂÀ´µÈ´ý²Ù×÷ϵͳÊä³öËüµÄԤдÈÕÖ¾£® ûÓÐ fsyncµÄʱºò£¬²Ù×÷ϵͳ¾Í¿ÉÒÔ¾¡¿ÉÄܵش¦ÀíºÃ »º³å£¬ÅÅÐò£¬ºÍºóд£¬Òò´Ë¿ÉÒÔÓзdz£ÏÔÖøµÄÐÔÄÜÌáÉý£® ²»¹ý£¬Èç¹ûϵͳ±ÀÀ££¬×îºó¼¸´ÎÌá½»µÄÊÂÎñµÄ²¿·Ö»òÈ«²¿Êý¾Ý¿ÉÄܻᶪʧ£® ×îÔã¸âµÄÇé¿öÊÇ¿ÉÄÜ·¢Éú²»¿É»Ö¸´µÄÊý¾Ý±ÀÀ££®

ÒòΪÉÏÃæµÄÔ­Òò£¬ÓÐЩ¹ÜÀíÔ±×ÜÊÇ°ÑËü¹Ø±Õ£¬ ÓÐЩֻÊÇÔÚ´óÁ¿Êý¾Ý×°ÔصÄʱºò²Å ¹Ø±ÕËü£¬ÕâÑùÈç¹û³ö´íÁ˵Ļ°¾ÍÓÐÒ»¸öÏÔ¶øÒ×¼ûµÄÖØпªÊ¼µÄÆðµã£® ÓÐЩÈË°ÑËü´ò¿ªÖ»ÊÇΪÁ˱£Ö¤°²È«£®ÒòΪÕâÑù×ö¸ü°²È«£¬ËùÒÔ È±Ê¡ÊÇ´ò¿ªµÄ£®Èç¹ûÄãÐÅÈÎÄãµÄ²Ù×÷ϵͳ£¬ÄãµÄ Ó²¼þºÍÄãµÄ¹¤¾ß¹«Ë¾£¨»òÕßÊÇÄãµÄ UPS£©£¬Äã¿ÉÄÜÔ¸Òâ¹Ø±ÕËü£®

ÎÒÃÇÐèÒªÖ¸³öµÄÊÇ×öfsyncµÄÐÔÄÜϽµÔÚ PostgreSQL °æ±¾ 7.1 ÀïÃæ±ÈÒÔÇ°°æ±¾ÏÔÖø¼õÉÙÁË£®Èç¹ûÒÔÇ°ÄãÒòΪÐÔÄÜÔ­Òò ½ûÖ¹ÁËfsync£¬ÄÇôÏÖÔÚÄã¿ÉÄÜ»áÖØп¼ÂÇһϣ®

Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖ㬻òÕßÉèÖÃÔÚ postgresql.conf ÎļþÀ

EXTRA_FLOAT_DIGITS (integer)

Õâ¸ö²ÎÊýµ÷ÕûΪ¸¡µãÊýÖµÏÔʾµÄλÊý£¬¸¡µãÊý°üÀ¨ float4£¬ float8£¬ºÍ¼¸ºÎÊý¾ÝÀàÐÍ¡£²ÎÊýÖµ¼Óµ½±ê׼λÊýÉÏÃ棨FLT_DIG »òÕß DBL_DIGÖÐÊÊÓõÄÄǸö£©¡£Õâ¸öÊýÖµ¿ÉÒÔÉèÖÃ×î¸ßΪ 2£¬ ÒÔ°üº¬²¿·ÖÓÐÓõÄÊý¾Ýλ£»Ëü¿ÉÒÔÓÃÓÚת´¢ÄÇЩÐèҪ׼ȷ»Ö¸´µÄ¸¡µãÊý¾Ý¡£ »òÕß¿ÉÒÔÉèÖóɸºÊýÒÔÏû³ý²»ÐèÒªµÄСÊýλ¡£

KRB_SERVER_KEYFILE(×Ö´®)

ÉèÖà Kerberos ·þÎñÆ÷ÃÜÔ¿ÎļþµÄλÖ㮲ÎÔÄ Section 4.2.3 »ñȡϸ½Ú£®

LC_MESSAGES (string)

ÉèÖÃÐÅÏ¢ÏÔʾµÄÓïÑÔ£®¿É½ÓÊܵÄÖµÊÇϵͳÏà¹ØµÄ£»²ÎÔÄ Section 5.1 »ñÈ¡¸ü¶àÐÅÏ¢£®Èç¹ûÕâ¸ö±äÁ¿ÉèÖÃΪ¿Õ×Ö´® (ȱʡֵ)£¬ÄÇôÆäÖµÒÔÒ»ÖÖϵͳÏà¹ØµÄ·½Ê½´Ó·þÎñÆ÷µÄÖ´Ðл·¾³Öм̳йýÀ´£®

ÔÚһЩϵͳÉÏ£¬Õâ¸öÇøÓò·¶³ë²¢²»´æÔÚ£®ÉèÖÃÕâ¸ö±äÁ¿ÈÔÈ»ÊÇÔÊÐíµÄ£¬ µ«Êǽ«²»»áÓÐÈκÎЧ¹û£®Í¬Ñù£¬Ò²ÓпÉÄÜÊÇËùÆÚÍûµÄÓïÑԵķ­ÒëÐÅÏ¢²» ´æÔÚ£®ÔÚÕâÖÖÇé¿öÏ£¬ÄãÈÔÈ»ÄÜ¿´µ½Ó¢ÎÄÐÅÏ¢£®

LC_MONETARY (string)

Ϊ¸ñʽ»¯½ð¶îÊýÁ¿ÉèÖÃÇøÓò£®±ÈÈçΪ to_char() ×庯ÊýÉèÖᣠ¿É½ÓÊܵÄÖµÊÇϵͳÏà¹ØµÄ£» ²ÎÔÄ Section 5.1 »ñÈ¡¸ü¶àÐÅÏ¢£®Èç¹ûÕâ¸ö ±äÁ¿ÉèÖÃΪ¿Õ×Ö´®(ȱʡֵ)£¬ÄÇôÆäÖµÊÇÒÔÒ»ÖÖϵͳÏà¹ØµÄ·½Ê½ ´Ó·þÎñÆ÷µÄÖ´Ðл·¾³Öм̳йýÀ´µÄ£®

LC_NUMERIC (string)

ÉèÖÃÓÃÓÚ¸ñʽ»¯Êý×ÖµÄÇøÓò£¬±ÈÈçÄÇЩÓÃÓÚ to_char() ×庯ÊýµÄ£®¿É½ÓÊܵÄÖµÊÇϵͳÏà¹ØµÄ£»²ÎÔÄ Section 5.1 »ñÈ¡¸ü¶àÐÅÏ¢£®Èç¹ûÕâ¸ö±äÁ¿ÉèÖÃΪ¿Õ×Ö´®(ȱʡֵ)£¬ÄÇôÆäÖµÒÔÒ»ÖÖ ÏµÍ³Ïà¹ØµÄ·½·¨´Ó·þÎñÆ÷µÄÖ´Ðл·¾³Öм̳йýÀ´£®

LC_TIME (string)

ÉèÖÃÓÃÓÚ¸ñʽ»¯ÈÕÆÚºÍʱ¼äÖµµÄÇøÓò£¬£¨Ä¿Ç°£¬Õâ¸öÉèÖÃʲôÊÂҲû¸É£¬ µ«½«À´¿ÉÄÜ»áÓÐÓᣣ©¡£ to_char() ×庯ÊýµÄ£®¿É½ÓÊܵÄÖµÊÇϵͳÏà¹ØµÄ£» ²ÎÔÄ Section 5.1 »ñÈ¡¸ü¶àÐÅÏ¢£®Èç¹ûÕâ¸ö±äÁ¿ÉèÖÃΪ¿Õ×Ö´® (ȱʡֵ)£¬ÄÇôÆäÖµÊÇÒÔÒ»ÖÖϵͳÏà¹ØµÄ·½Ê½´Ó·þÎñÆ÷µÄÖ´Ðл·¾³Öм̳йýÀ´µÄ£®

MAX_CONNECTIONS£¨ÕûÊý£©

¾ö¶¨ÔÊÐí¶àÉÙ¸ö²¢·¢Áª½Ó£®È±Ê¡ÊÇ 32 (³ý·ÇÔÚÖÆ×÷·þÎñÆ÷µÄʱºòÐÞ¸Ä)£® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

MAX_EXPR_DEPTH£¨ÕûÊý£©

ÉèÖ÷ÖÎöÆ÷½ÓÊܵÄ×î´ó±í´ïʽǶÌ×Éî¶È£®È±Ê¡Öµ¶ÔÈκγ£¼û²éѯÀ´Ëµ ¶¼¹»¸ßÁË£¬µ«ÊÇÈç¹ûÄãÐèÒªµÄ»°Äã¿ÉÒÔÌá¸ßÕâ¸öÊýÖµ£® £¨²»¹ýÈç¹ûÄã°ÑËüÉýµÃÌ«¸ß£¬Äã¾ÍµÃðÒòΪջÒç³öµ¼Öµĺó¶Ë±ÀÀ£ µÄ·çÏÕ£®£©

MAX_FILES_PER_PROCESS (integer)

ÉèÖÃÿ¸ö·þÎñÆ÷×Ó½ø³ÌÖÐͬʱ´ò¿ªµÄÎļþÊýÄ¿µÄ×î´óÖµ£® ȱʡÊÇ 1000£®´úÂëʵ¼ÊʹÓõÄÏÞÖÆÒª±ÈÕâ¸öÉèÖÃÒÔ¼° sysconf(_SC_OPEN_MAX) µÄ½á¹ûС£® Òò´Ë£¬ÔÚÄÇЩ·µ»ØºÏÀíÏÞÖƵÄϵͳÉÏ£¬ÄãÓò»×ŵ£ÐÄÕâ¸öÉèÖã® µ«ÊÇÔÚһЩƽ̨ÉÏ(ÌرðÊÇ´ó¶àÊý BSD ϵͳ)£¬ sysconf·µ»ØµÄÖµÒªÔ¶±È´óÁ¿½ø³ÌͬʱÊÔͼ´ò¿ª¸ÃÊýÁ¿µÄÎļþʱ ϵͳËùÄÜÖ§³ÖµÄ´ó£®Èç¹ûÄã·¢ÏÖ×Ô¼º¿´µ½ "´ò¿ªÌ«¶àÎļþ(Too many open files)"´íÎó£¬ ÄÇôÊÔ׎µµÍÕâ¸öÉèÖÿ´¿´£®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯Ê±ÉèÖ㬠»òÕßÔÚ postgresql.conf ÅäÖÃÎļþÖÐÉèÖã» Èç¹ûÔÚÅäÖÃÎļþÖÐÐÞ¸ÄÁËËü£¬ÄÇôËüÖ»Ó°ÏìËæºóÆô¶¯µÄ·þÎñÆ÷×Ó½ø³Ì£®

MAX_FSM_PAGES (integer)

ÉèÖÃÄÇЩ×ÔÓÉ¿Õ¼äÊÇͨ¹ý·ÅÔÚ¹²ÏíµÄ×ÔÓÉ¿Õ¼äÓ³Éä±íÖнøÐиú×ÙµÄ ×î´ó´ÅÅÌÒ³ÃæÊýÄ¿£®È±Ê¡ÊÇ 10000£®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

MAX_FSM_RELATIONS (integer)

ÉèÖÃÄÇЩ×ÔÓÉ¿Õ¼äÊÇͨ¹ý·ÅÔÚ¹²ÏíµÄ×ÔÓÉ¿Õ¼äÓ³Éä±íÖнøÐиú×ٵĹØϵ(±í)µÄ ×î´óÊýÄ¿£® ȱʡÊÇ 100£®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

MAX_LOCKS_PER_TRANSACTION (integer)

¹²Ïí±íµÄ´óСÊÇÒÔ¼ÙÉèÈÎÒâʱ¿Ì×î¶àÖ»ÓÐ max_locks_per_transaction * max_connections ¸ö¶ÀÁ¢µÄ¶ÔÏóÐèÒª±»ËøסΪ»ù´¡½øÐмÆËãµÄ£®È±Ê¡Öµ 64£¬ÒѾ­¾­ÀúÊ·Ö¤Ã÷ ÊÇ×ã¹»µÄÁË£¬²»¹ýÈç¹ûÄãµÄ¿Í»§¿ÉÄÜÔÚÒ»¸öÊÂÎñÀïÃæÐ޸ĺܶ಻ͬµÄ±í£¬ ÄÇôÄã¾Í¿ÉÄÜÐèÒªÌá¸ßÕâ¸öÊýÖµ£®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

PASSWORD_ENCRYPTION (boolean)

ÔÚ CREATE USER »òÕß ALTER USER ÀïÃæÉùÃ÷ÁË¿ÚÁ µ«ÊǼÈûÓÐд ENCRYPTED ҲûÓÐдUNENCRYPTED£¬ ÄÇôÕâ¸ö±êÖ¾¾ö¶¨¿ÚÁîÊÇ·ñ¼ÓÃÜ¡£È±Ê¡ÊÇ´ò¿ª£¨¼ÓÃÜ¿ÚÁ¡£

PORT£¨ÕûÊý£©

·þÎñÆ÷ÕìÌýµÄ TCP ¶Ë¿Ú£»È±Ê¡ 5432£®Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

SEARCH_PATH (string)

Õâ¸ö±äÁ¿ÉùÃ÷ģʽµÄËÑË÷˳Ðò£¬ÔÚÒ»¸ö±»ÒýÓöÔÏó(±í£¬Êý¾ÝÀàÐÍ£¬º¯ÊýµÈ) Ö»ÊÇÒ»¸ö¼òµ¥Ãû×Ö£¬Ã»Óи½¼Óģʽ²¿·ÖʱÐèÒªÕâÑùµÄËÑË÷£® Èç¹ûÔÚÁíÍâÒ»¸öģʽÀïÓÐÒ»¸öÏàͬµÄ¶ÔÏóÃû£¬ÄÇôʹÓÃÔÚÕâ¸öËÑË÷·¾¶ÖÐ ÕÒµ½µÄµÚÒ»¸ö£®Ò»¸öûÓÐÔÚËÑË÷·¾¶ÖÐÈκÎÒ»¸öģʽÀï³öÏֵĶÔÏó Ö»ÄÜͨ¹ýÆäËùÔÚģʽµÄÈ«³Æ(´òµãµÄ)Ãû×ÖÀ´ÉùÃ÷£®

search_path µÄÖµ±ØÐèÊÇÒ»¸ö¶ººÅ·Ö¸ôµÄģʽµÄÁÐ±í£® Èç¹ûÁбíÏîÖ®Ò»ÊÇÌØÊâÖµ $user£¬ÄÇô¸Ãģʽ ºÍ SESSION_USER Ëù´ú»»µÄÃû×ÖÒ»Ñù --- Èç¹û´æÔÚÕâ¸öģʽµÄ»°£® (Èç¹ûûÓУ¬ÄÇôºöÂÔ $user£®)

ϵͳ±íģʽ£¬pg_catalog£¬×ÜÊDZ»ËÑË÷£¬²»¹ÜÎÒÃÇÓÐûÓÐ ÔÚ·¾¶ÀïÌáµ½Ëü£®Èç¹ûÎÒÃÇÔÚ·¾¶ÖÐÌáµ½Ëü£¬ÄÇô½«°´ÕÕÖ¸¶¨µÄ˳ÐòËÑË÷£® Èç¹û pg_catalog ûÓÐÔÚ·¾¶ÖУ¬ÄÇôËü½«ÔÚÈκη¾¶Ïî ֮ǰµÃµ½ËÑË÷£®ÎÒÃÇ»¹Òª×¢ÒâµÄÊÇ£¬ÁÙʱ±íģʽ£¬ pg_temp_nnn£¬Ò²Òþº¬ÔÚÈκÎÕâЩÏî֮ǰµÃµ½ËÑË÷£®

Èç¹û´´½¨¶ÔÏóʱûÓÐÉùÃ÷Ìض¨µÄÄ¿±êģʽ£¬ÄÇôËü½«±»·Åµ½ËÑË÷ ·¾¶ÖеĵÚÒ»¸öģʽ¡£Èç¹ûËÑË÷·¾¶Êǿյģ¬ÄÇô»á±¨¸æÒ»¸ö´íÎó¡£

Õâ¸ö²ÎÊýµÄȱʡֵÊÇ '$user, public' (Èç¹ûûÓÐ ½Ð public µÄģʽ£¬ÄÇôµÚ¶þ²¿·Ö½«±»ºöÂÔ)£® ÕâÑù¾ÍÖ§³Ö¹²ÏíʹÓÃÒ»¸öÊý¾Ý¿â(Õâ¸öʱºòûÓÐÓû§ÓµÓÐ˽ÓÐģʽ£¬ ²¢ÇÒËùÓÐÈ˶¼¹²ÏíʹÓà public)£¬Ë½ÓеÄÿÓû§µÄģʽ£¬ÒÔ¼° ÕâЩµÄ×éºÏ£®ÆäËüЧ¹û¿ÉÒÔͨ¹ý(È«¾Ö»òÕßÿÓû§µØ)ÐÞ¸ÄËÑË÷·¾¶ÉèÖûñÈ¡£®

ËÑË÷·¾¶µ±Ç°µÄÓÐЧֵ¿ÉÒÔÓà SQL º¯Êý current_schemas() ¼ì²é£®ËüºÍ¼ì²é search_path µÄÖµ²¢²»Ì«Ò»Ñù£¬ ÒòΪ current_schemas() ÏÔʾµÄÊÇÔÚ search_path Àï³öÏÖµÄÇëÇóÈçºÎ±»·ÖÎö£®

ÓйØģʽ´¦ÀíµÄ¸ü¶àÐÅÏ¢£¬²ÎÔÄ PostgreSQL 7.3 Óû§Êֲᡣ

STATEMENT_TIMEOUT (integer)

Í˳öÈκÎÖ´ÐеÄʱ¼ä³¬¹ýÖ¸¶¨ºÁÃëÊýµÄÓï¾ä¡£ÁãÖµ¹Ø±ÕÕâ¸ö¼ÆʱÆ÷¡£

SHARED_BUFFERS£¨ÕûÊý£©

ÉèÖÃÊý¾Ý¿â·þÎñÆ÷½«Ê¹ÓõĹ²ÏíÄڴ滺³åÇøÊýÁ¿£®È±Ê¡ÊÇ 64£® ÿ¸ö»º³åÇø´óСµÄµäÐÍÖµÊÇ 8192 ×Ö½Ú£® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

SILENT_MODE(bool)

°²¾²µØÔËÐзþÎñÆ÷£®Èç¹ûÉèÖÃÕâ¸öÑ¡Ï ·þÎñÆ÷½«×Ô¶¯ ÔÚºǫ́ÔËÐв¢ÇÒÅ×Æúµô¿ØÖÆ tty£¬Òò´Ë²»»áÓÐÈÎÒâÐÅÏ¢Êä³öµ½stdout »òstderr£¨ºÍpostmasterµÄ-SÑ¡ÏîЧ¹ûÏàͬ£©£®³ý·Ç´ò¿ªÁË ±ÈÈçsyslogÕâÑùµÄÈÕ־ϵͳ£¬ ÎÒÃDz»½¨ÒéʹÓÃÕâ¸öÑ¡ÏÒòΪÕâÑùÁî²éÕÒ´íÎóÐÅÏ¢·Ç³£À§ÄÑ£®

SORT_MEM£¨ÕûÊý£©

ÉùÃ÷ÔÚÇóÖúÓÚÁÙʱ´ÅÅÌÎļþ֮ǰÓÃÓÚÄÚ²¿ÅÅÐòºÍÉ¢ÁУ¨hash£©µÄÄÚ´æ µÄÊýÁ¿£®´ËÖµÊÇÒÔǧ×Ö½ÚΪ¼ÆÁ¿µ¥Î»µÄ£¬È±Ê¡Îª 1024KB£¨1MB£©£® Çë×¢Ò⣬¶ÔÓÚ¸´ÔÓ²éѯ£¬¶à¸öÅÅÐòºÍ/»òÉ¢ÁУ¨hash£©¿ÉÄܻᲢÐÐ ÔËÐУ¬¶øÇÒÔÚ¿ªÊ¼ÏòÁÙʱÎļþÊä³öÊý¾Ý֮ǰ£¬ ÿ¸ö²Ù×÷¶¼»á±»ÔÊÐíʹÓÃÕâÀïÉùÃ÷µÄÊýÁ¿µÄÄڴ森 ÒòΪÿ¸öºó¶Ë¶¼»á×öÒ»¸ö»ò¸ü¶àµÄÅÅÐò£¬Òò´ËÐèÒªµÄ¿Õ¼ä¿ÉÄÜÊÇ SORT_MEMµÄÐí¶à±¶£® ORDER BY£¬ÈÚºÏÁ¬½Ó£¬ÒÔ¼°CREATE INDEX¶¼»á½øÐÐÅÅÐò¡£

SQL_INHERITANCE£¨²¼¶û£©

Õâ¸öÑ¡Ïî¿ØÖƼ̳ÐÓïÒ壬ÓÈÆäÊÇÔÚȱʡʱÊÇ·ñÔÚ¸÷ÖÖÃüÁîÀï °Ñ×Ó±í°üÀ¨½øÀ´£® °æ±¾ 7.1 ÒÔÇ°ÊDz»°üÀ¨µÄ£®Èç¹ûÄãÐèÒªÀÏÌØÐÔ£¬Äã¿ÉÒÔ°ÑÕâ¸ö±äÁ¿ ÉèΪ¼Ù£¬µ«ÊÇ´Ó³¤Ô¶¿´À´£¬ÎÒÃǽ¨ÒéÄãÐÞ¸ÄÄãµÄÓ¦ÓÃÒÔʹÓà ONLY ¹Ø¼ü×ÖÀ´Åųý×Ó±í£®²Î¿¼ SQL ÓïÑÔË÷Òý ºÍ PostgreSQL 7.3 Óû§ÊÖ²á »ñÈ¡¹ØÓڼ̳еĸü¶àÐÅÏ¢£®

SSL(²¼¶ûÊý)

´ò¿ª SSL Áª½Ó£®Ê¹ÓÃ֮ǰÇë²ÎÔÄ Section 3.7 £®È±Ê¡Êǹأ®

SUPERUSER_RESERVED_CONNECTIONS (integer)

¾ö¶¨±£Áô¸ø PostgreSQL ³¬¼¶Óû§Ê¹ÓõÄ"Á¬½Ó²Ûλ"¡£ ×î¶à max_connections ¸öÁ¬½Ó¿ÉÒÔͬʱ¼¤»î¡£Èç¹û»îÔ¾µÄ²¢·¢Á¬½Ó Êý´ïµ½ÁË max_connections ¼õÈ¥ superuser_reserved_connections ¸ö£¬ÄÇôֻÓг¬¼¶Óû§ÕʺÅÉÏÀ´µÄÁ¬½Ó²Å±»½ÓÊÜ¡£

ȱʡֵÊÇ 2¡£Õâ¸öÊýÖµ±ØÐë±È max_connections С¡£ Õâ¸ö²ÎÊýÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖá£

TCPIP_SOCKET£¨²¼¶û£©

Èç¹û´ËֵΪÕ棬ÄÇô·þÎñÆ÷½ÓÊÜ TCP/IP Áª½Ó£® ·ñÔòÖ»½ÓÊܱ¾µØµÄ Unix ÓòÌ×½Ó×ÖÁª½Ó£® ȱʡÊǹرգ® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖã®

TRANSFORM_NULL_EQUALS (boolean)

Èç¹û´ò¿ªËü£¬ÄÇôÏÂÃæÕâÑùµÄ±í´ïʽ expr = NULL (»òÕß NULL = expr) ±»µ±×ö expr IS NULL£¬´¦Àí£¬Ò²¾ÍÊÇ˵£¬ Èç¹û expr µÃ³ö NULL ÖµÔò·µ»ØÕ棬·ñÔò·µ»Ø¼Ù£® expr = NULL µÄÕýÈ·µÄÐÐΪ×ÜÊÇ·µ»Ø NULL(δ֪)£®Òò´ËÕâ¸öÑ¡ÏîȱʡʱÊǹرյģ®

²»¹û£¬ÔÚMicrosoft AccessÀïµÄ¹ýÂË±íµ¥ Éú³ÉµÄ²éѯºÃÏñʹÓõÄÊÇ expr = NULL ²âÊÔ¿ÕÖµ£¬ Òò´Ë£¬Èç¹ûÄãʹÓÃÕâ¸ö½çÃæ·ÃÎÊÊý¾Ý¿â£¬Äã¿ÉÄÜÏë°ÑÕâ¸öÑ¡Ïî´ò¿ª£® ÒòΪÐÎÈç expr = NULL µÄ ±í´ïʽ×ÜÊÇ·µ»Ø NULL (ʹÓÃÕýÈ·µÄ´ú»»)£¬Òò´ËËüÃDz¢²»³£Ó㬠¶øÇÒÔÚÒ»°ãµÄÓ¦ÓÃÖÐÒ²²»³£¼û£¬Òò´ËÕâ¸öÑ¡Ïîʵ¼ÊÉÏûÓÐʲôº¦´¦£® µ«ÊÇÐÂÓû§³£³£ÔÚÉæ¼° NULL µÄ±í´ïʽÓïÒåÉϸе½ºúÍ¿£¬ Òò´Ëȱʡʱ²»´ò¿ªÕâ¸öÑ¡Ï

Çë×¢ÒâÕâ¸öÑ¡ÏîÖ»Ó°ÏìÎı¾µÄ = ²Ù×÷·û£¬ ²»°üÀ¨ÆäËü±È½Ï²Ù×÷·û»òÕßÆäËüÓëһЩÉæ¼°µÈºÅ²Ù×÷·ûµÄ ±í´ïʽ¼ÆËã(±ÈÈç IN)£®Òò´Ë£¬Õâ¸öÑ¡Ïî²»ÊÇ À¬»ø³ÌÐòµÄ¹·Æ¤¸àÒ©£®

Çë²Î¿¼ PostgreSQL 7.3 Óû§ÊÖ²á »ñÈ¡Ïà¹ØÐÅÏ¢£®

UNIX_SOCKET_DIRECTORY(string)

ÉùÃ÷·þÎñÆ÷ÓÃÓÚÕìÌýÀ´×Ô¿Í»§¶ËÓ¦ÓÃÁª½ÓµÄ Unix ÓòÌ×½Ó×ÖĿ¼Ãû£® ȱʡͨ³£ÊÇ /tmp£¬²»¹ý¿ÉÒÔÔÚÖÆ×÷ʱ¸Ä±ä£®

UNIX_SOCKET_GROUP(string)

ÉèÖà Unix ÓòÌ×½Ó×ÖµÄ×éËùÓÐÈË£®£¨Ì×½Ó×ÖµÄËùÓÐȨÓû§×ÜÊÇÆô¶¯ ·þÎñÆ÷µÄÓû§£®£©Óë UNIX_SOCKET_PERMISSIONS Ñ¡ÏîÒ»ÆðʹÓÿÉÒÔ¸øÕâÖÖÌ×½Ó×ÖÀàÐÍÔö¼Ó¶îÍâµÄ·ÃÎÊ¿ØÖÆ»úÖÆ£® ȱʡʱÊÇÒ»¸ö¿Õ×Ö´®£¬Ò²¾ÍÊÇʹÓõ±Ç°Óû§µÄȱʡµÄ×飮 Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯Ê±ÉèÖã®

UNIX_SOCKET_PERMISSIONS(ÕûÐÍ)

¸ø Unix ÓòÌ×½Ó×ÖÉèÖ÷ÃÎÊȨÏÞ£®Unix ÓòÌ×½Ó×ÖʹÓÃͨ³£µÄ Unix ÎļþϵͳȨÏÞ¼¯£®¿ÉÑ¡µÄÖµ¿ÉÒÔÊÇÒ»¸ö chmod ºÍ umask ϵͳµ÷ÓÿÉÒÔ½ÓÊܵÄÊý×Öģʽ£® £¨ÒªÊ¹Óÿͻ§»¯µÄ°Ë½øÖƸñʽ£¬¸ÃÊý×Ö±ØÐëÒÔ 0 £¨Á㣩¿ªÍ·£®£©

ȱʡȨÏÞÊÇ 0777£¬Òâ¼´ÈκÎÈ˶¼¿ÉÒÔÁª½Ó£® ºÏÀíµÄÑ¡Ôò¿ÉÄÜÊÇ0770 £¨Ö»ÓÐÓû§ºÍ×飬 ²ÎÔÄUNIX_SOCKET_GROUP£©ºÍ 0700 £¨Ö»ÓÐÓû§£©£® £¨Çë×¢Òâ¶ÔÓÚ Unix Ì×½Ó×Ö¶øÑÔ£¬Êµ¼ÊÉÏÖ»ÓÐдȨÏÞÓÐÒâÒ壬¶øÇÒ Ò²Ã»Óа취ÉèÖûòÕßÈ¡Ïû¶Á»òÖ´ÐÐȨÏÞ£®£©

ÕâÖÖ·ÃÎÊ¿ØÖÆ»úÖÆÊÇºÍ Chapter 4. ÀïÃæÃèÊöµÄÄÇЩÍêÈ«¶ÀÁ¢µÄ£®

Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯Ê±ÉèÖã®

VIRTUAL_HOST(string)

ÉùÃ÷ postmaster ÓÃÓÚÕìÌýÀ´×Ô¿Í»§¶ËÓ¦ÓÃÁª½ÓµÄ TCP/IP Ö÷»úÃû»òÕßµØÖ·£® ȱʡÊÇ PGHOST »·¾³±äÁ¿µÄÖµ£¬ Èç¹ûûÓÐÉèÖà PGHOST£¬È±Ê¡ÊÇÕìÌý ËùÓÐÅäÖÃÁ˵ĵØÖ·£¨°üÀ¨localhost£©£®

3.4.5. WAL

ÓÖ¼û Section 11.3 »ñÈ¡ WAL µ÷½ÚµÄϸ½Ú£®

CHECKPOINT_SEGMENTS(ÕûÊý)

ÔÚ×Ô¶¯ WAL ¼ì²éµãÖ®¼äµÄ×î´ó¾àÀ룬µ¥Î»ÊÇÈÕÖ¾Îļþ¶Î £¨Ã¿¸ö¶ÎÒ»°ãÊÇ 16 Õ××Ö½Ú£©£® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖ㬻òÕßÉèÖÃÔÚ postgresql.conf ÎļþÀ

CHECKPOINT_TIMEOUT(ÕûÊý)

×Ô¶¯ WAL ¼ì²éµãÖ®¼äµÄ×ʱ¼ä£¬ÒÔÃë¼Æ£® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖ㬻òÕßÉèÖÃÔÚ postgresql.conf ÎļþÀ

CHECKPOINT_WARNING (integer)

Èç¹ûÒòΪÌî³ä¼ì²éµã¶ÎÎļþµ¼Öµļì²éµã·¢ÉúµÃ±ÈÕâ¸öÊýÖµµÃÃëÊý¸üƵ·±£¬ ÔòÏò·þÎñÆ÷ÈÕÖ¾Öз¢ËÍÐÅÏ¢¡£Áã¹Ø±Õ¾¯¸æ¡£

COMMIT_DELAY (integer)

дһ¸öÌá½»µÄ¼Ç¼µ½ WAL »º³åºÍ°Ñ»º³å³åË¢µ½´ÅÅÌÉϵÄʱ¼ä¼ä¸ô£¬ ÒÔºÁÃë¼Æ£®·ÇÁãµÄÑÓ³ÙÔÊÐí¶à¸öÊÂÎñÓÃÒ»¸öfsyncÌá½»£¬Ìõ¼þÊÇ ÏµÍ³µÄ¸ººÉ¸ßµ½ÔÚ¸ø³öµÄ¼ä¸ôÀïÆäËüµÄÊÂÎñÒѾ­¿ÉÒÔÌá½»ÁË£® Èç¹ûûÓÐÆäËüµÄÊÂÎñ×¼±¸ºÃ½øÐÐÌá½»£¬ÄÇôÕâ¸öÑÓ³Ù¾ÍÊÇÀË·Ñʱ¼ä£® Òò´Ë£¬Õâ¸öÑÓ³ÙÖ»ÓÐÔÚºó¶Ë°ÑËüµÄÌá½»¼Ç¼д³öµÄ˲¼äÖÁÉÙÓÐ COMMIT_SIBLINGS¸öÆäËüµÄÊÂÎñ»îÔ¾µÄÇé¿öϲÅÖ´ÐУ®

COMMIT_SIBLINGS (integer)

ÔÚÖ´ÐÐCOMMIT_DELAYÑÓ³Ù֮ǰËùÒªÇóµÄ²¢ÐеĴò¿ªµÄÊÂÎñµÄ×îµÍÊýÄ¿£® ÊýÖµÔ½´ó£¬¾ÍÔ½ÓпÉÄÜÖÁÉÙÓÐÁíÍâÒ»¸öÊÂÎñÔÚÑӳٵļä¸ôÖÐ×öºÃÁËÌá½»µÄ ×¼±¸£®

WAL_BUFFERS(ÕûÊý)

¹²ÏíÄÚ´æÖÐÓÃÓÚ WAL µÄ´ÅÅÌÒ³»º³åÇøÊýÄ¿£® Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯Ê±ÉèÖã®

WAL_DEBUG(ÕûÊý)

Èç¹ûΪ·ÇÁ㣬ÔòÔÚstderrÉÏ´ò¿ªÓë WAL Ïà¹ØµÄµ÷ÊÔÊä³ö£®

WAL_SYNC_METHOD(×Ö´®)

ÓÃÓÚÇ¿ÖÆ WAL ¸üе½´ÅÅÌÉϵķ½·¨£®¿ÉÄܵÄÊýÖµÊÇ FSYNC £¨ÔÚÿ´ÎÌύʱµ÷ÓÃfsync()£© FDATASYNC £¨ÔÚÿ´ÎÌύʱµ÷ÓÃfdatasync()£© OPEN_SYNC £¨ÓôøO_SYNCÑ¡ÏîµÄopen() д WAL Îļþ£©£¬»òÕßÊÇ OPEN_DATASYNC £¨ÓôøO_DSYNCÑ¡ÏîµÄopen() д WAL Îļþ£©£® ²¢·ÇÔÚËùÓÐƽ̨É϶¼¿ÉÒÔʹÓÃÕâЩѡÏ Õâ¸öÑ¡ÏîÖ»ÄÜÔÚ·þÎñÆ÷Æô¶¯µÄʱºòÉèÖ㬻òÕßÉèÖÃÔÚ postgresql.conf ÎļþÀ

3.4.6. ¶ÌÑ¡Ïî

ΪÁË·½±ãÆð¼û£¬ÕâÀﻹΪÐí¶à²ÎÊýÌṩÁ˺ö൥×ÖĸѡÏ¹Ø£® ËüÃÇÔÚÏÂTable 3-2ÀïÃèÊö£®

Table 3-2. ¶ÌÑ¡Ïî¼ü×Ö

¶ÌÑ¡ÏîÆÀ×¢
-B xshared_buffers = x
-d xserver_min_messages = DEBUGx
-Ffsync = off
-h xvirtual_host = x
-itcpip_socket = on
-k xunix_socket_directory = x
-lssl = on
-N xmax_connections = x
-p xport = x
-fi, -fh, -fm, -fn, -fs, -ft[a] enable_indexscan=off, enable_hashjoin=off, enable_mergejoin=off, enable_nestloop=off, enable_seqscan=off, enable_tidscan=off
-s[a]show_statement_stats = on
-S x[a]sort_mem = x
-tpa,-tpl,-te[a]log_parser_stats=on,log_planner_stats=on,log_executor_stats=on
Notes:
a. ÒòΪÀúÊ·Ô­Òò£¬ÕâЩѡÏîͨ¹ý-o postmaster Ñ¡Ïî´«µÝ¸ø¶ÀÁ¢µÃºó¶Ë½ø³Ì£¬±ÈÈ磬

$ postmaster -o '-S 1024 -s'

»òÕßÊÇͨ¹ý¿Í»§¶ËµÄ PGOPTIONS£¬ ÏñÉÏÃæ½âÊ͵ØÄÇÑù¡£