From a76606454cba15f85d6bcbc9c73e364cf6a346c5 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 4 Jun 2005 03:28:57 +0000 Subject: [PATCH] Update Chinese FAQ to fix XHTML format. Weiping (Laser) --- doc/FAQ_chinese | 1291 ++++++++++------------- doc/src/FAQ/FAQ_chinese.html | 1865 ++++++++++++++++------------------ 2 files changed, 1385 insertions(+), 1771 deletions(-) diff --git a/doc/FAQ_chinese b/doc/FAQ_chinese index cae9589bd5..9e0dd9b33f 100644 --- a/doc/FAQ_chinese +++ b/doc/FAQ_chinese @@ -1,152 +1,118 @@ PostgreSQL ³£¼ûÎÊÌ⣨FAQ£© - ×î½ü¸üУº2003 Äê 01 Ô 06 ÈÕ ÐÇÆÚÒ» 22:27:35 CST + ×î½ü¸üУº2005 Äê 06 Ô 02 ÈÕ ÐÇÆÚÎå 22:27:35 CST Ŀǰά»¤ÈËÔ±£ºBruce Momjian (pgman@candle.pha.pa.us) - ÖÐÎÄ°æά»¤ÈËÔ±£ººÎΰƽ £¨laser@pgsqldb.com £© + ÖÐÎÄ°æά»¤ÈËÔ±£ºdoudou586 £¨doudou586_2005@yahoo.com.cn£© - ±¾ÎĵµµÄ×îа汾¿ÉÒÔÔÚhttp://www.postgresql.org/files/documentation/fa - qs/FAQ.html ²é¿´¡£ + ±¾ÎĵµµÄ×îа汾¿ÉÒÔÔÚ + http://www.postgresql.org/files/documentation/faqs/FAQ.html²é¿´¡£ - ²Ù×÷ϵͳƽ̨Ïà¹ØµÄÎÊÌâÔÚhttp://www.postgresql.org/docs/faq/Àï»Ø´ð¡£ + Óë²Ù×÷ϵͳƽ̨Ïà¹ØµÄÎÊÌâÔÚhttp://www.postgresql.org/docs/faq/Àï»Ø´ð¡£ _________________________________________________________________ - ³£¼ûÎÊÌâ - - 1.1) PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿ - 1.2) PostgreSQL µÄ°æȨÊÇʲô? - 1.3) PostgreSQL ÔËÐÐÔÚʲô Unix ƽ̨ÉÏ£¿ - 1.4) ¿ÉÓÃµÄ·Ç Unix ƽ̨ÓÐÄÇЩ£¿ - 1.5) ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿ - 1.6) ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL µÄÖ§³Ö£¿ - 1.7) PostgreSQL ×îеİ汾ÊÇʲô£¿ - 1.8) ÓÐÄÄЩ¿ÉÓÃµÄ PostgreSQL µÄÎĵµ£¿ - 1.9) ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG »òȱʧµÄÌØÐÔ£¿ - 1.10) ÎÒÓ¦¸ÃÔõÑùѧϰ SQL £¿ - 1.11) PostgreSQL ÊÇ Y2K ¼æÈݵÄÂ𣿠- 1.12) ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿 - 1.13) ÎÒÓ¦¸ÃÔõÑùÌá½»Ò»¸ö BUG ±¨¸æ£¿ - 1.14) PostgreSQL ºÍÆäËû DBMS ±ÈÆðÀ´ÈçºÎ£¿ - 1.15) ÎÒÓ¦¸ÃÔõÑùÔÞÖú PostgreSQL £¿ - - Óû§¿Í»§¶ËÎÊÌâ - - 2.1) ÓÐ PostgreSQL µÄ ODBC Çý¶¯³ÌÐòô£¿ - 2.2) ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web Ò³Ã棿 - 2.3) PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂ𣿠- 2.4) ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL ´ò½»µÀ£¿ - - ϵͳ¹ÜÀíÎÊÌâ - - 3.1) ÎÒÔõÑùÄÜ°Ñ PostgreSQL ×°ÔÚ /usr/local/pgsql ÒÔÍâµÄµØ·½£¿ - 3.2) µ±ÎÒÔËÐÐ postmaster ʱ£¬³öÏÖ Bad System Call£¨ÏµÍ³µ÷ÓÃ´í£©»ò Core - Dumped ´íÎó¡£ÎªÊ²Ã´£¿ - 3.3) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ IpcMemoryCreate ´íÎó¡£ÎªÊ²Ã´£¿ - 3.4) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ IpcSemaphoreCreate - ´íÎó¡£ÎªÊ²Ã´£¿ - 3.5) ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿ - 3.6) ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿ - 3.7) PostgreSQL Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿ - 3.8) ΪʲôÔÚÊÔͼÁ¬½ÓµÇ¼ʱÊÕµ½¡°Sorry, too many clients¡± ÏûÏ¢£¿ - 3.9) pgsql_tmp Ŀ¼ÀﶼÓÐЩʲô£¿ - 3.10) ΪʲôҪÔÚÉý¼¶ PostgreSQL ·¢²¼°æ±¾Ê±×ö dump ºÍ restore £¿ - - ²Ù×÷ÎÊÌâ - - 4.1) ¶þ½øÖÆÓαêºÍÆÕͨÓαêÖ®¼äµÄÇø±ðÊÇʲô£¿ - 4.2) ÈçºÎֻѡÔñÒ»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿ - 4.3) ÎÒÈçºÎ»ñÈ¡Ò»¸öÊý¾Ý¿âÖбíµÄÁÐ±í£¬»òÕßÊÇÆäËûÎÒÄÜÔÚ psql - Àï¿´µ½µÄ¶«Î÷£¿ - 4.4) ÔõÑù´Ó±íÀïÃæɾ³ýÒ»ÁУ¿ - 4.5) Ò»ÐУ¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿ - 4.6) ´æ´¢Ò»¸öµäÐ͵ÄÎı¾ÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿 - 4.7) ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿 - 4.8) ÎҵIJéѯºÜÂý»òÕßûÓÐÀûÓÃË÷Òý¡£ÎªÊ²Ã´£¿ - 4.9) ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑù´¦ÀíÎҵIJéѯµÄ£¿ - 4.10) R-tree Ë÷ÒýÊÇʲô£¿ - 4.11) ʲôÊÇ»ùÒò²éѯÓÅ»¯£¨Genetic Query Optimization£©£¿ - 4.12) - ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽ²éÕÒ£¿ÔõÑùÀûÓÃË÷Òý½øÐдó - СдÎ޹زéÕÒ£¿ - 4.13) ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ NULL£¿ - 4.14) ¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿ - 4.15.1) ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿ - 4.15.2) ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿ - 4.15.3) ʹÓà currval() ºÍ nextval() »áµ¼ÖºÍÆäËûÓû§µÄÎÉÂÒÇé¿ö£¨race - condition£©Â𣿠- 4.15.4) - Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖдæÔÚ¼ä - ¶ÏÄØ£¿ - 4.16) ʲôÊÇ OID£¿Ê²Ã´ÊÇ TID £¿ - 4.17) PostgreSQL ʹÓõÄһЩÊõÓïµÄº¬ÒåÊÇʲô£¿ - 4.18) ΪʲôÎÒÊÕµ½´íÎó¡°ERROR: Memory exhausted in AllocSetAlloc()¡±£¿ - 4.19) ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL µÄ°æ±¾£¿ - 4.20) ΪʲôÎҵĴó¶ÔÏó²Ù×÷µ¼Ö´íÎó¡°invalid large obj - descriptor¡±£¨·Ç·¨µÄ´ó¶ÔÏóÃèÊö·û£©£¿ - 4.21) ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿ - 4.22) ΪʲôʹÓà IN µÄ×Ó²éѯÕâôÂý£¿ - 4.23) ÈçºÎ½øÐÐ outer join £¨ÍâÁ¬½Ó£©£¿ - 4.24) ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿ - 4.25) ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿ - 4.26) ΪʲôÔÚ PL/PgSQL º¯ÊýÖв»ÄÜ¿É¿¿µØ´´½¨»òɾ³ýÁÙʱ±í£¿ - 4.27) ÓÐÄÄЩÊý¾Ý¸´ÖÆÑ¡Ï - 4.28) ÓÐÄÄЩÊý¾Ý¼ÓÃÜÑ¡Ï - - À©Õ¹ PostgreSQL - - 5.1) ÎÒдÁËÒ»¸öÓû§¶¨Ò庯Êý¡£µ±ÎÒÔÚ psql ÀïÔËÐÐʱ£¬ÎªÊ²Ã´»áµ¼Ö core - dump£¿ - 5.2) ÎÒÈçºÎÄܸø PostgreSQL ¹±Ï×һЩͦ²»´íµÄÐÂÀàÐͺͺ¯Êý£¿ - 5.3) ÎÒÔõÑùдһ¸ö·µ»ØÒ»Ìõ¼Ç¼µÄ C º¯Êý£¿ - 5.4) ÎÒÐÞ¸ÄÁËÒ»¸öÔ´Îļþ£¬ÎªÊ²Ã´ÖØбàÒëºóûÓп´µ½¸Ä±ä£¿ +³£¼ûÎÊÌâ + + 1.1)PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿ + 1.2)PostgreSQL µÄ°æȨÊÇʲô£¿ + 1.3)PostgreSQL ¿ÉÒÔÔËÐÐÔÚÄÄЩ²Ù×÷ϵͳƽ̨ÉÏ£¿ + 1.4)ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿ + 1.5)ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL µÄÖ§³Ö£¿ + 1.6)ÎÒÈçºÎÌá½»Ò»¸öBUG±¨¸æ£¿ + 1.7)×îаæµÄPostgreSQL ÊÇʲô£¿ + 1.8)Äܹ»»ñÈ¡µÄ×îÐÂÎĵµÓÐÄÄЩ£¿ + 1.9)ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG »òÔÝȱµÄ¹¦ÄÜ£¿ + 1.10)ÎÒÓ¦¸ÃÔõÑùѧϰ SQL £¿ + 1.11)ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿 + 1.12)PostgreSQL ºÍÆäËûÊý¾Ý¿âϵͳ±ÈÆðÀ´ÈçºÎ£¿ + 1.13)Ë¿ØÖƺ͹ÜÀíPostgreSQL £¿ + +Óû§¿Í»§¶ËÎÊÌâ + + 2.1)ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL ´ò½»µÀ£¿ + 2.2)ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web Ò³Ã棿 + 2.3)PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂ𣿠+ +ϵͳ¹ÜÀíÎÊÌâ + + 3.1)ÎÒÔõÑù²ÅÄÜ°Ñ PostgreSQL ×°ÔÚ /usr/local/pgsql ÒÔÍâµÄµØ·½£¿ + 3.2)ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿ + 3.3)ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿ + 3.4)PostgreSQL Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿ + 3.5)ΪʲôÔÚÊÔͼÁ¬½ÓµÇ¼ʱÊÕµ½¡°Sorry, too many clients¡± ÏûÏ¢£¿ + 3.6)ΪʲôҪÔÚÉý¼¶ PostgreSQL Ö÷Òª·¢²¼°æ±¾Ê±×ö dump ºÍ restore £¿ + 3.7)(ʹÓÃPostgreSQL)ÎÒÐèҪʹÓÃʲô¼ÆËã»úÓ²¼þ £¿ + +²Ù×÷ÎÊÌâ + + 4.1)ÈçºÎֻѡÔñÒ»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿»òÊÇËæ»úµÄÒ»ÐУ¿ + 4.2)ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿ÈçºÎ²é¿´psqlÀïÓõ½µÄ²éѯָ + Áî²¢ÏÔʾËüÃÇ£¿ + 4.3)ÈçºÎ¸ü¸ÄÒ»¸ö×ֶεÄÊý¾ÝÀàÐÍ£¿ + 4.4)Ò»ÐмǼ£¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿ + 4.5)´æ´¢Ò»¸öµäÐ͵ÄÎı¾ÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿 + 4.6)ΪʲôÎҵIJéѯºÜÂý£¿ÎªÊ²Ã´ÕâЩ²éѯûÓÐÀûÓÃË÷Òý£¿ + 4.7)ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑùÆÀ¹À´¦ÀíÎҵIJéѯµÄ£¿ + 4.8)ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽ²éÕÒ£¿ÔõÑùÀûÓÃË÷Òý½ø + ÐдóСдÎ޹زéÕÒ£¿ + 4.9)ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ + NULL£¿ÎÒÈçºÎ²ÅÄÜ׼ȷÅÅÐò¶ø²»ÂÛij×Ö¶ÎÊÇ·ñº¬NULLÖµ£¿ + 4.10)¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿ + 4.11.1)ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿ + 4.11.2)ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿ + 4.11.3)ʹÓà currval() »áµ¼ÖºÍÆäËûÓû§µÄÎÉÂÒÇé¿ö£¨race condition£©Â𣿠+ 4.11.4)Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖ + дæÔÚ¼ä¶ÏÄØ£¿ + 4.12)ʲôÊÇ OID£¿Ê²Ã´ÊÇ CTID £¿ + 4.13)ΪʲôÎÒÊÕµ½´íÎóÐÅÏ¢¡°ERROR: Memory exhausted in + AllocSetAlloc()¡±£¿ + 4.14)ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL µÄ°æ±¾£¿ + 4.15)ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿ + 4.16)ÈçºÎ½øÐÐ outer join £¨ÍâÁ¬½Ó£©£¿ + 4.17)ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿ + 4.18)ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿ + 4.19)ΪʲôÎÒÔÚʹÓÃPL/PgSQLº¯Êý´æÈ¡ÁÙʱ±íʱ»áÊÕµ½´íÎóÐÅÏ¢¡°relation + with OID ##### does not exist¡±£¿ + 4.20)Ä¿Ç°ÓÐÄÄЩÊý¾Ý¸´ÖÆ·½°¸¿ÉÓã¿ _________________________________________________________________ - ³£¼ûÎÊÌâ - - 1.1) PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿ +³£¼ûÎÊÌâ + + 1.1)PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿ - PostgreSQL ¶Á×÷ Post-Gres-Q-L ¡£ - - PostgreSQL ÊÇÏÂÒ»´ú DBMS µÄÑо¿ÔÐÍ POSTGRES - Êý¾Ý¿â¹ÜÀíϵͳµÄÔöÇ¿°æ¡£PostgreSQL ÔÚ±£³Ö POSTGRES - µÄÇ¿´óµÄÊý¾ÝÄ£ÐͺͷḻµÄÊý¾ÝÀàÐ͵Ļù´¡ÉÏ£¬ÓÃÒ»¸öÀ©Õ¹Á赀 SQL - ×Ó¼¯È¡´úÁËÔÏ鵀 PostQuel ²éѯÓïÑÔ¡£PostgreSQL - ÊÇ×ÔÓɵIJ¢ÇÒËùÓÐÔ´´úÂ붼¿ÉÒÔ»ñµÃ¡£ - - PostgreSQL µÄ¿ª·¢ÓÉ²Î¼Ó PostgreSQL - ¿ª·¢ÓʼþÁбíµÄÒ»¸ö¿ª·¢ÈËԱС×é½øÐС£Ä¿Ç°µÄе÷ÈËÊÇ Marc G. Fournier - £¨scrappy@postgreSQL.org - £©¡££¨¹ØÓÚÈçºÎ¼ÓÈë²Î¼û1.6½Ú£©¡£Õâ¸ö¶ÓÎéÏÖÔÚ¸ºÔð PostgreSQL - µÄËùÓпª·¢¡£ + PostgreSQL ¶Á×÷ Post-Gres-Q-L£¬ÓÐʱºòÒ²¼ò³ÆΪPostgres ¡£ - PostgreSQL 1.01 µÄ×÷ÕßÊÇ Andrew Yu ºÍ Jolly - Chen¡£»¹ÓÐÐí¶àÆäËûÈËΪÒÆÖ²£¬²âÊÔ£¬µ÷ÊÔºÍÔöÇ¿´úÂë×öÁË´óÁ¿¹±Ïס£PostgreS - QL µÄ×î³õÆðÔ´ Postgres£¬ÊÇÔÚ¼ÓÖÝ´óѧ²®¿ËÀû·ÖУµÄ Michael Stonebraker - ½ÌÊÚµÄÖ¸µ¼Ï£¬ÓÉÐí¶àÑо¿Éú£¬±¾¿ÆÉúºÍ±à³ÌÖ°Ô±Íê³ÉµÄ¡£ + PostgreSQL + ÊÇÃæÏòÄ¿±êµÄ¹ØϵÊý¾Ý¿âϵͳ£¬Ëü¾ßÓд«Í³ÉÌÒµÊý¾Ý¿âϵͳµÄËùÓй¦ÄÜ£¬Í¬Ê±ÓÖ + º¬Óн«ÔÚÏÂÒ»´ú DBMS ϵͳµÄʹÓõÄÔöÇ¿ÌØÐÔ¡£ PostgreSQL + ÊÇ×ÔÓÉÃâ·ÑµÄ£¬²¢ÇÒËùÓÐÔ´´úÂ붼¿ÉÒÔ»ñµÃ¡£ - Õâ¸öÈí¼þ×î³õÔÚ²®¿ËÀûµÄÃû×ÖÊÇ Postgres¡£ÔÚ 1995 Ä꣬µ±Ôö¼ÓÁË SQL - ¹¦Äܺó£¬ËüµÄÃû×Ö¸Ä³É Postgres95¡£ÔÚ 1996ÄêÄ©£¬²Å¸ÄÃûΪ PostgreSQL¡£ + PostgreSQL + µÄ¿ª·¢¶ÓÎéÖ÷ҪΪ־ԸÕߣ¬ËûÃDZ鲼ÊÀ½ç¸÷µØ²¢Í¨¹ý»¥ÁªÍø½øÐÐÁªÏµ£¬ÕâÊÇÒ»¸ö + ÉçÇø¿ª·¢ÏîÄ¿£¬Ëü²»±»Èκι«Ë¾¿ØÖÆ¡£ + ÈçÏë¼ÓÈ뿪·¢¶ÓÎ飬Çë²Î¼û¿ª·¢ÈËÔ±³£¼ûÎÊÌ⣨FAQ£© + http://www.postgresql.org/files/documentation/faqs/FAQ_DEV.html - 1.2) PostgreSQL µÄ°æȨÊÇʲô? + 1.2)PostgreSQL µÄ°æȨÊÇʲô? - PostgreSQL ÊÜÏÂÃæµÄ°æȨԼÊø¡£ + PostgreSQLµÄ·¢²¼×ñ´Ó¾­ + µäµÄBSD°æȨ¡£¹ØÓÚÔ´´úÂëµÄÈçºÎʹÓÃûÓÐÈκÎÏÞÖÆ£¬ÎÒÃǺÜϲ»¶ÕâÖÖ·½Ê½²¢ÇÒ» + ¹Ã»ÓдòËã¸Ä±äËü¡£ - PostgreSQL Êý¾Ý¿â¹ÜÀíϵͳ + ÏÂÃæ¾ÍÊÇÎÒÃÇʹÓõÄBSD°æȨÄÚÈÝ£º - £¨PostgreSQL Data Base Management System£© + ²¿·Ö°æȨ£¨c£©1996-2005£¬PostgreSQL + È«Çò¿ª·¢Ð¡×飬²¿·Ö°æȨ£¨c£©1994-1996 ¼ÓÖÝ´óѧ¶Ê - ²¿·Ö°æȨ£¨c£©1996-2002£¬PostgreSQL È«Çò¿ª·¢Ð¡×é - ²¿·Ö°æȨ£¨c£©1994-6 ¼ÓÖÝ´óѧ¶Ê - - £¨Portions copyright (c) 1996-2002, PostgreSQL Global Development - Group - Portions Copyright (c) 1994-6 Regents of the University of + £¨Portions copyright (c) 1996-2005, PostgreSQL Global Development + Group Portions Copyright (c) 1994-6 Regents of the University of California£© ÔÊÐíΪÈκÎÄ¿µÄʹÓ㬿½±´£¬Ð޸ĺͷַ¢Õâ¸öÈí¼þºÍËüµÄÎĵµ¶ø²»ÊÕÈ¡ÈκηÑÓà - £¬²¢ÇÒÎÞÐëÇ©ÊðÒò´Ë¶ø²úÉúµÄÖ¤Ã÷£¬Ç°ÌáÊÇÉÏÃæµÄ°æȨÉùÃ÷ºÍ±¾¶ÎÒÔ¼°ÏÂÃæÁ½¶Î - ÎÄ×Ö³öÏÖÔÚËùÓп½±´ÖС£ + £¬ + ²¢ÇÒÎÞÐëÇ©ÊðÒò´Ë¶ø²úÉúµÄÖ¤Ã÷£¬Ç°ÌáÊÇÉÏÃæµÄ°æȨÉùÃ÷ºÍ±¾¶ÎÒÔ¼°ÏÂÃæÁ½¶ÎÎÄ + ×Ö³öÏÖÔÚËùÓп½±´ÖС£ £¨Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written @@ -155,8 +121,9 @@ copies.£© ÔÚÈκÎÇé¿öÏ£¬¼ÓÖÝ´óѧ¶¼²»³Ðµ£ÒòʹÓôËÈí¼þ¼°ÆäÎĵµ¶øµ¼ÖµĶÔÈκε±ÊÂÈË - µÄÖ±½ÓµÄ£¬¼ä½ÓµÄ£¬ÌØÊâµÄ£¬¸½¼ÓµÄ»òÕßÏà°é¶øÉúµÄË𻵣¬°üÀ¨ÀûÒæËðʧµÄÔðÈÎ - £¬¼´Ê¹¼ÓÖÝ´óѧÒѾ½¨ÒéÁËÕâЩËðʧµÄ¿ÉÄÜÐÔʱҲÊÇÈç´Ë¡£ + µÄÖ±½ÓµÄ£¬ + ¼ä½ÓµÄ£¬ÌØÊâµÄ£¬¸½¼ÓµÄ»òÕßÏà°é¶øÉúµÄË𻵣¬°üÀ¨ÀûÒæËðʧµÄÔðÈΣ¬¼´Ê¹¼ÓÖÝ + ´óѧÒѾ½¨ÒéÁËÕâЩËðʧµÄ¿ÉÄÜÐÔʱҲÊÇÈç´Ë¡£ £¨IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL @@ -165,8 +132,9 @@ HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.£© ¼ÓÖÝ´óѧÃ÷È··ÅÆúÈκα£Ö¤£¬°üÀ¨µ«²»¾ÖÏÞÓÚijһÌض¨ÓÃ;µÄÉÌÒµºÍÀûÒæµÄÒþº¬ - ±£Ö¤¡£ÕâÀïÌṩµÄÕâ·ÝÈí¼þÊÇ»ùÓÚ¡°µ±×÷ÊÇ¡±µÄ»ù´¡µÄ£¬Òò¶ø¼ÓÖÝ´óѧûÓÐÔðÈÎ - Ìṩά»¤£¬Ö§³Ö£¬¸üУ¬ÔöÇ¿»òÕßÐ޸ĵķþÎñ¡£ + ±£Ö¤¡£ + ÕâÀïÌṩµÄÕâ·ÝÈí¼þÊÇ»ùÓÚ¡°µ±×÷ÊÇ¡±µÄ»ù´¡µÄ£¬Òò¶ø¼ÓÖÝ´óѧûÓÐÔðÈÎÌṩά + »¤£¬Ö§³Ö£¬¸üУ¬ÔöÇ¿»òÕßÐ޸ĵķþÎñ¡£ £¨THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -174,823 +142,584 @@ PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.£© - ÉÏÃæ¾ÍÊÇ BSD °æȨÉùÃ÷£¬Ò»¸ö¾­ - µäµÄ¿ªÔ´°æȨÉùÃ÷¡£Ëü¶ÔÔ´´úÂëµÄʹÓÃδ×÷ÈκÎÏÞÖÆ¡£ÎÒÃÇϲ»¶Ëü²¢ÇÒ²»´òËã¸Ä - ±äËü¡£ - 1.3) PostgreSQL ÔËÐÐÔÚʲô Unix ƽ̨ÉÏ£¿ + 1.3)PostgreSQL ¿ÉÒÔÔËÐÐÔÚÄÄЩ²Ù×÷ϵͳƽ̨ÉÏ£¿ Ò»°ã˵À´£¬Ò»¸öÏÖ´úµÄ UNIX ¼æÈݵÄƽ̨¶¼ÄÜÔËÐÐ PostgreSQL ¡£ÔÚ°²×°Ö¸ÄÏÀïÁгöÁË·¢²¼Ê±¾¹ýÃ÷È·²âÊÔµÄƽ̨¡£ - 1.4) ¿ÉÓÃµÄ·Ç Unix ƽ̨ÓÐÄÄЩ£¿ - - ¿Í»§¶Ë - - °Ñ libpq C ¿â£¬psql£¬ÆäËû½Ó¿ÚºÍ¿Í»§¶ËÓ¦ÓóÌÐò±àÒë³É¿ÉÒÔÔÚ MS Windows - ƽ̨ÉÏÔËÐÐÊÇ¿ÉÄܵġ£ÕâÖÖÇé¿öÏ£¬¿Í»§¶ËÔÚ MS Windows ÉÏÔËÐУ¬²¢ÇÒͨ¹ý - TCP/IP ÓëÒ»¸öÔËÐÐÔÚÎÒÃÇÖ§³ÖµÄ Unix - ƽ̨ÉϵķþÎñÆ÷½øÐÐͨѶ¡£·¢²¼°æ±¾Öаüº¬Ò»¸öÎļþ win32.mak ÓÃÓÚÉú³É - Win32 libpq ¿âºÍ psql ¡£PostgreSQL Ò²¿ÉÒÔºÍ ODBC ¿Í»§¶ËͨѶ¡£ - - ·þÎñÆ÷ + PostgreSQlÒ²¿ÉÒÔÖ±½ÓÔËÐÐÔÚ»ùÓÚ΢ÈíWindows-NTµÄ²Ù×÷ϵͳ£¬ÈçWin2000£¬Win + XP ºÍ Win2003£¬ÒÑÖÆ×÷Íê³ÉµÄ°²×°°ü¿É´Ó + http://pgfoundry.org/projects/pginstallerÏÂÔØ£¬»ùÓÚMSDOSµÄWindows²Ù×÷Ï + µÍ³ £¨Win95£¬Win98£¬WinMe£©ÐèҪͨ¹ýCygwinÄ£Äâ»·¾³ÔËÐÐPostgreSQL¡£ - Êý¾Ý¿â·þÎñÆ÷ÏÖÔÚ¿ÉÒÔͨ¹ý Cygwin £¬Cygnus µÄ Unix/NT ÒÆÖ²¿âÔÚ Windows - NT ºÍ Win2k ÉÏÔËÐС£²ÎÔÄ·¢²¼°æ±¾ÀïµÄ See pgsql/doc/FAQ_MSWIN Îļþ»ò - http://www.PostgreSQL.org/docs/faq-mswin.html ¡£ + ͬʱҲÓÐÒ»¸öΪNovell Netware 6¿ª·¢µÄ°æ±¾¿É´Ó http://forge.novell.com + »ñÈ¡£¬ÎªOS/2¿ª·¢µÄ°æ±¾¿É´Ó + http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&button=Search&key=postgre + SQL&stype=all&sort=type&dir=%2F - ÒÆÖ²µ½ MS Win NT/2000/XP µÄ±¾»ú°æµÄ¹¤×÷ÕýÔÚ½øÐС£ - - 1.5) ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿ + 1.4)ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿ - PostgreSQL µÄÖ÷ÄäÃûFTPÕ¾µãÊÇ - ftp://ftp.PostgreSQL.org/pub£¬¾µÏñÕ¾µã¿ÉÒԲο¼ÎÒÃÇÍøÕ¾µÄÖ÷Ò³¡£ + ͨ¹ýä¯ÀÀÆ÷¿É´Óhttp://www.postgresql.org/ftp/ÏÂÔØ£¬Ò²¿Éͨ¹ýFTP£¬´Ó + ftp://ftp.PostgreSQL.org/pub/Õ¾µãÏÂÔØ¡£ - 1.6) ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL µÄÖ§³Ö£¿ + 1.5)ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL µÄÖ§³Ö£¿ - Ö÷ÒªµÄÓʼþÁбíÊÇ£ºpgsql-general@postgreSQL.org¡£¿ÉÒÔÔÚÄÇÀïÌÖÂÛÓÐ¹Ø - PostgreSQL µÄÎÊÌâ¡£Òª¼ÓÈëÁÐ±í£¬·¢Ò»·âÓʼþÄÚÈÝ£¨²»ÊÇÖ÷ÌâÐУ©Îª - subscribe - end - - µÄÓʼþµ½ pgsql-general-request@postgreSQL.org ¡£ + PostgreSQLÉçÇøͨ¹ýÓʼþÁбíΪÆä´ó¶àÊýÓû§Ìṩ°ïÖú£¬¼ÓÈëÓʼþÁбíµÄÖ÷Õ¾µã + ÊÇ + http://www.postgresql.org/community/lists/£¬Ò»°ãÇé¿öÏ£¬ÏȼÓÈëGeneral + »ò BugÓʼþÁбíÊÇÒ»¸ö½ÏºÃµÄ¿ªÊ¼¡£ - »¹¿ÉÒÔ»ñÈ¡ÕªÒªÁÐ±í¡£Òª¼ÓÈëÕâ¸öÁÐ±í£¬·¢Óʼþµ½£ºpgsql-general-digest-req - uest@postgreSQL.org£¬ÆäÄÚÈÝΪ£º - subscribe - end - - ÿµ±Ö÷Áбí´ïµ½´óÔ¼ 30k µÄÏûÏ¢ÄÚÈÝʱ£¬ÕªÒª¾Í·¢Ë͸øÕâ¸öÁбíµÄ³ÉÔ±¡£ + Ö÷ÒªµÄIRCƵµÀÊÇÔÚFreeNode(irc.freenode.net)µÄ#postgresql£¬ÎªÁËÁ¬ÉÏ´ËƵ + µÀ£¬¿ÉÒÔʹÓÃUNIX³ÌÐòirc£¬ÆäÖ¸Áî¸ñʽ£º irc -c '#postgresql' "$USER" + irc.freenode.net + £¬»òÕßʹÓÃÆäËûIRC¿Í»§¶Ë³ÌÐò¡£ÔÚ´ËÍøÂçÖл¹´æÔÚÒ»¸öPostgreSQLµÄÎ÷°àÑÀƵµ + À(#postgersql-es)ºÍ·¨ÓïƵµÀ + (#postgresql-fr)¡£Í¬ÑùµØ£¬ÔÚEFNETÉÏÒ²ÓÐÒ»¸öPostgreSQLµÄ½»Á÷ƵµÀ¡£ - »¹¿ÉÒԲμӳô³æÓʼþÁÐ±í¡£Òª¼ÓÈëÕâ¸öÁÐ±í£¬·¢ËÍÒ»¸öÓʼþµ½ - bugs-request@postgreSQL.org£¬ÄÚÈÝΪ£º - subscribe - end - - »¹¿ÉÒԲμӿª·¢ÈËÔ±ÓʼþÁÐ±í¡£Òª¼ÓÈëÕâ¸öÁÐ±í£¬·¢ËÍÒ»¸öÓʼþµ½ - hackers-request@postgreSQL.org£¬ÄÚÈÝΪ£º - subscribe - end - - ÆäËûµÄ¹ØÓÚ PostgreSQL ÓʼþÁбíºÍÆäËûÐÅÏ¢¿ÉÒÔÔÚ PostgreSQL µÄ WWW - Ö÷Ò³ÕÒµ½£º + ÉÌÒµÖ§³Ö¹«Ë¾µÄÁбíÔÚ http://techdocs.postgresql.org/companies.php¡£ - http://postgresql.org/ - - ÔÚ EFNet ÀﻹÓÐÒ»¸ö IRC ƵµÀ£¬ÆµµÀ #PostgreSQL¡£ÎÒÓà unix ÃüÁîirc -c - '#PostgreSQL' "$USER" irc.phoenix.net + 1.6)ÎÒÈçºÎÌá½»Ò»¸öBUG±¨¸æ£¿ + + ¿É·ÃÎÊ + http://www.postgresql.org/support/submitbug£¬ÌîдBugÉϱ¨±í¸ñ¼´¿É¡£ - ÉÌÒµÖ§³Ö¹«Ë¾µÄÁбíÔÚ - http://www.PostgreSQL.org/users-lounge/commercial-support.html ¡£ + ͬÑùÒ²¿É·ÃÎÊftpÕ¾µãftp://ftp.PostgreSQL.org/pub/ + ¼ì²éÓÐÎÞ¸üеÄPostgreSQL°æ±¾»ò²¹¶¡¡£ - 1.7) PostgreSQL ×îеİ汾ÊÇʲô£¿ + 1.7)×îаæµÄPostgreSQL ÊÇʲô£¿ - PostgreSQL ×îеİ汾ÊÇ°æ±¾ 7.2.3¡££¨Òë×¢£ºÏÖÔÚÓ¦¸ÃÊÇ 7.3.1 ÁË¡££© + PostgreSQL ×îеİ汾ÊÇ°æ±¾ 8.0.2 £¨Òë×¢£ºÏÖ×îа汾Ϊ8.0.3£©¡£ - ÎÒÃǼƻ®Ã¿ËĸöÔ·¢²¼Ò»¸öÖ÷Òª°æ±¾¡£ + ÎÒÃǼƻ®Ã¿Äê·¢²¼Ò»¸öÖ÷Òª°æ±¾£¬Ã¿¼¸¸öÔ·¢²¼Ò»¸öС°æ±¾¡£ - 1.8) ÓÐÄÄЩ¿ÉÓÃµÄ PostgreSQL µÄÎĵµ£¿ + 1.8)Äܹ»»ñÈ¡µÄ×îÐÂÎĵµÓÐÄÄЩ£¿ - ÔÚ·¢²¼°üÀïÓÐһЩÊֲᣬÊÖ²áÒ³ºÍһЩСµÄ²âÊÔÀý×Ó¡£²Î¼û /doc - Ŀ¼¡££¨Òë×¢£ºÓ¦Îª $PGHOME/doc£©¡£Ä㻹¿ÉÒÔÔÚÏßä¯ÀÀ PostgreSQL - µÄÊֲᣬÔÚ http://www.PostgreSQL.org/users-lounge/docs/ ¡£ + PostgreSQL°üº¬´óÁ¿µÄÎĵµ£¬Ö÷ÒªÓÐһЩÊֲᣬÊÖ²áÒ³ºÍһЩµÄ²âÊÔÀý×Ó¡£²Î¼û + /doc Ŀ¼£¨Òë×¢£ºÓ¦Îª $PGHOME/doc£©¡£ Ä㻹¿ÉÒÔÔÚÏßä¯ÀÀ PostgreSQL + µÄÊֲᣬÆäµØÖ·ÊÇ£ºhttp://www.PostgreSQL.org/docs¡£ ÓÐÁ½±¾¹ØÓÚ PostgreSQL µÄÊéÔÚÏßÌṩ£¬ÔÚ http://www.PostgreSQL.org/docs/awbook.html ºÍ - http://www.commandprompt.com/ppbook/ ¡£ÔÚ - http://www.ca.PostgreSQL.org/books/ ÉÏÓйØÓÚ PostgreSQL - µÄ¿É¹ºÊé¼®µÄÁÐ±í¡£ÔÚ http://techdocs.PostgreSQL.org/ ÉÏÊÕ¼¯ÁËÓÐ¹Ø - PostgreSQL µÄ¼¼ÊõÎÄÕ¡£ - - psql ÓÐһЩ²»´íµÄ \d ÃüÁÏÔʾ¹ØÓÚÀàÐÍ£¬²Ù×÷·û£¬º¯Êý£¬¾Û¼¯µÈµÄÐÅÏ¢¡£ - - ÎÒÃÇµÄ web Õ¾µã°üº¬¸ü¶àµÄÎĵµ£® - - 1.9) ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG ºÍȱʧµÄÌØÐÔ£¿ - - PostgreSQL Ö§³ÖÒ»¸öÀ©Õ¹Á赀 SQL-92 µÄ×Ó¼¯¡£²ÎÔÄÎÒÃÇµÄ TODO - ÁÐ±í£¬»ñÈ¡Ò»¸öÒÑÖª³ô³æ£¬È±Ê§ÌØÐÔºÍδÀ´¼Æ»®¡£ + http://www.commandprompt.com/ppbook/ ¡£ + Ò²ÓдóÁ¿µÄPostgreSQLÊé¼®¿É¹©¹ºÂò£¬ÆäÖÐ×îΪÁ÷ÐеÄÒ»±¾ÊÇÓÉKorry + Douglas±àдµÄ¡£ÔÚ + http://techdocs.PostgreSQL.org/techdocs/bookreviews.phpÉÏ + ÉÏÓдóÁ¿ÓйØPostgreSQLÊé¼®µÄ¼ò½é¡£ ÔÚ + http://techdocs.PostgreSQL.org/ÉÏÊÕ¼¯ÁËÓÐ¹Ø PostgreSQL + µÄ´óÁ¿¼¼ÊõÎÄÕ¡£ - 1.10) ÎÒÓ¦¸ÃÔõÑùѧϰ SQL£¿ - - ÔÚ http://www.postgresql.org/docs/awbook.html µÄ¹ØÓÚ PostgreSQL - µÄÊé½ÌÊÚ SQL¡££¨Òë×¢£ºÎÒÏÂÔص½±¾µØÁË¡££©ÔÚ - http://www.commandprompt.com/ppbook ÓÐÁíÍâÒ»±¾¹ØÓÚ PostgreSQL - µÄÊé¡£ÔÚhttp://www.intermedia.net/support/sql/sqltut.shtm£¬http://ourw - orld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM ºÍ - http://sqlcourse.com ÓÐÒ»¸ö²»´íµÄÈëÃŽ̡̳£ - - ÁíÒ»¸öÊÇ "Teach Yourself SQL in 21 Days, Second - Edition"£¨21Ììѧ»áSQL£¬µÚ¶þ°æ£©£¬ÔÚ - http://members.tripod.com/er4ebus/sql/index.htm + ¿Í»§¶ËµÄÃüÁîÐгÌÐòpsqlÓÐһЩÒÔ \d + ¿ªÍ·µÄÃüÁ¿ÉÏÔʾ¹ØÓÚÀàÐÍ£¬²Ù×÷·û£¬º¯Êý£¬»ã×ܵȵÄÐÅÏ¢£¬Ê¹Óà \? + ¿ÉÒÔÏÔʾËùÓпÉÓõÄÃüÁî¡£ - ÎÒÃǵÄÐí¶àÓû§Ï²»¶ The Practical SQL Handbook, Bowman, Judith S., et - al., Addison-Wesley ¡£ ÆäËûµÄÓÐ The Complete Reference SQL, Groff et - al., McGraw-Hill ¡£ + ÎÒÃÇµÄ web Õ¾µã°üº¬¸ü¶àµÄÎĵµ¡£ - 1.11) PostgreSQL ÊÇ Y2K ¼æÈݵÄÂ𣿠+ 1.9)ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG »òÔÝȱµÄ¹¦ÄÜ£¿ - ÊÇ£¬ÎÒÃǺÜÈÝÒ׿ØÖÆ 2000 AD Ö®ºóºÍ 2000 BC ֮ǰµÄÈÕÆÚ¡£ + PostgreSQL Ö§³ÖÒ»¸öÀ©Õ¹Á赀 SQL-92 µÄ×Ó¼¯¡£²ÎÔÄÎÒÃǵÄTODO + ÁÐ±í£¬»ñÈ¡Ò»¸öÒÑÖªBug£¬ÔÝȱµÄ¹¦Äܺͽ«À´µÄ¼Æ»®¡£ - 1.12) ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿 + 1.10)ÎÒÓ¦¸ÃÔõÑùѧϰ SQL £¿ - Ê×ÏÈ£¬ÏÂÔØ×îеÄÔ´´úÂë²¢ÔĶÁÎÒÃÇ web Õ¾µã»ò·¢²¼°üÖÐµÄ PostgreSQL - ¿ª·¢ÕßÎĵµ¡£Æä´Î£¬¼ÓÈë pgsql-hackers ºÍ pgsql-patches - ÓʼþÁÐ±í¡£µÚÈý£¬Ïò pgsql-patches Ìá½»¸ßÖÊÁ¿µÄ²¹¶¡³ÌÐò¡£ + Ê×ÏÈ¿¼ÂÇÉÏÊöÌáµ½µÄÓëPostgreSQLÏà¹ØµÄÊé¼®£¬ÁíÍâÒ»±¾ÊÇTeach Yourself SQL + in 21 Days, Second Edition£¬ ÎÒÃǵÄÐí¶àÓû§Ï²»¶The Practical SQL + Handbook Bowman, Judith S., et al., Addison-Wesley£¬ÆäËûµÄÔòϲ»¶ The + Complete Reference SQL, Groff et al., McGraw-Hill¡£ - ÏÖÔÚ´ó¸ÅÓÐÊ®¼¸¸öÈËÓÐ PostgreSQL CVS ¹éµµ COMMIT µÄȨÏÞ¡£ËûÃǶ¼ÒѾ­ - Ìá½»Á˷dz£¶à¸ßÖÊÁ¿µÄ²¹¶¡ÁË£¬ÒÔÖÁÓÚÏÖÓеÄÌá½»È˺ÜÄѸúÉϽÚ×࣬²¢ÇÒÎÒÃÇÏà - ÐÅËûÃÇÌá½»µÄ²¹¶¡¶¼ÊǸßÖÊÁ¿µÄ¡£ - - 1.13) ÎÒÓ¦¸ÃÔõÑùÌá½»Ò»¸öBUG±¨¸æ£¿ + 1.11)ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿 - Çë·ÃÎÊ http://www.PostgreSQL.org/bugs/bugs.php µÄ PostgreSQL BugTool - Ò³Ãæ, ÄÇÀï¸ø³öÁËÈçºÎÌá½»Ò»¸öBUG±¨¸æµÄÖ¸ÄÏ¡£ - - ͬÑùÒ²Òª¿´¿´ÎÒÃÇµÄ ftp Õ¾µã - ftp://ftp.postgreSQL.org/pub£¬¿´ÓÐûÓиüÐ嵀 PostgreSQL °æ±¾»ò²¹¶¡¡£ + Ïê¼û Developer's FAQ ¡£ - 1.14) PostgreSQL ºÍÆäËû DBMS ±ÈÆðÀ´ÈçºÎ£¿ + 1.12)PostgreSQL ºÍÆäËûÊý¾Ý¿âϵͳ±ÈÆðÀ´ÈçºÎ£¿ ÆÀ¼ÛÈí¼þÓкü¸ÖÖ·½·¨£ºÌØÐÔ£¬ÐÔÄÜ£¬¿É¿¿ÐÔ£¬Ö§³ÖºÍ¼Û¸ñ¡£ ÌØÐÔ - PostgreSQL ÓµÓдóÐÍÉÌÓà DBMS - Àï´ó¶àÊýÌØÐÔ£¬ÀýÈ磺ÊÂÎñ£¬×Ó²éѯ£¬´¥·¢Æ÷£¬ÊÓͼ£¬Íâ¼ü²Î¿¼ÍêÕûÐÔº - ͸´ÔÓµÄËøµÈ¡£ÎÒÃÇ»¹ÓÐһЩËüÃÇûÓеÄÌØÐÔ£¬ÈçÓû§¶¨ÒåÀàÐÍ£¬¼Ì³Ð£¬ - ¹æÔòºÍ¶à°æ±¾²¢ÐпØÖÆÒÔ¼õÉÙËøµÄÕùÓõȡ£ + PostgreSQL ÓµÓдóÐÍÉÌÓà DBMS Àï´ó¶àÊýÌØÐÔ£¬ + ÀýÈ磺ÊÂÎñ£¬×Ó²éѯ£¬´¥·¢Æ÷£¬ÊÓͼ£¬Íâ¼ü²Î¿¼ÍêÕûÐԺ͸´ÔÓµÄËøµÈ¡£ + ÎÒÃÇ»¹ÓÐһЩËüÃÇûÓеÄÌØÐÔ£¬ÈçÓû§¶¨ÒåÀàÐÍ£¬¼Ì³Ð£¬¹æÔòºÍ¶à°æ±¾² + ¢ÐпØÖÆÒÔ¼õÉÙËøµÄÕùÓõȡ£ ÐÔÄÜ - PostgreSQL - ºÍÆäËûÉÌÓúͿªÔ´µÄÊý¾Ý¿â¾ßÓÐÀàËƵÄÐÔÄÜ¡£¶ÔijЩ´¦ÀíËü±È½Ï¿ì£¬¶ÔÆ - äËûһЩ´¦ÀíËü±È½ÏÂý¡£Óë MySQL »ò¸üÇá±ãµÄÊý¾Ý¿âϵͳ±È½Ï£¬ÎÒÃÇÔÚ - insert/update ʱÂý£¬ÒòΪÎÒÃÇÓÐÊÂÎñ´¦Àí¡£µ±È» MySQL - ²»¾ßÓÐÎÒÃÇÔÚÉÏÃæµÄÌØÐÔ - ¶ÎÀï¸ø³öµÄÈκÎÌØÐÔ¡£ÎÒÃǵÄÖ÷Òª·½ÏòÊÇ¿É¿¿ÐÔºÍÌØÐÔ£¬¾¡¹ÜÎÒÃÇÔÚÿ´ - η¢²¼Ê±²»¶ÏµØ¸Ä½øÐÔÄÜ¡£ÓÐÒ»¸öºÜÓÐȤµÄÍøÒ³±È½ÏÁË PostgreSQL ºÍ - MySQL http://openacs.org/why-not-mysql.html¡£ + PostgreSQL ºÍÆäËûÉÌÓúͿªÔ´µÄÊý¾Ý¿â¾ßÓÐÀàËƵÄÐÔÄÜ¡£ + ¶ÔijЩ´¦ÀíËü±È½Ï¿ì£¬¶ÔÆäËûһЩ´¦ÀíËü±È½ÏÂý¡£ + ÓëÆäËûÊý¾Ý¿âÏà±È£¬ÎÒÃǵÄÐÔÄÜͨ³£ÔÚ +/- 10%Ö®¼ä¡£ ¿É¿¿ÐÔ - ÎÒÃÇÖªµÀ DBMS - ±ØÐëÊÇ¿É¿¿µÄ£¬·ñÔòËü¾ÍÒ»µãÓö¼Ã»ÓС£ÎÒÃÇŬÁ¦×öµ½·¢²¼¾­ + ÎÒÃÇÖªµÀ DBMS ±ØÐëÊÇ¿É¿¿µÄ£¬·ñÔòËü¾ÍÒ»µãÓö¼Ã»ÓС£ + ÎÒÃÇŬÁ¦×öµ½·¢²¼¾­ ¹ýÈÏÕæ²âÊԵģ¬Îȶ¨µÄ³ô³æ×îÉٵĴúÂ롣ÿ¸ö°æ±¾ÖÁÉÙÓÐÒ»¸öÔ嵀 beta - ²âÊÔ£¬²¢ÇÒÎÒÃǵķ¢²¼ÀúÊ·ÏÔʾÎÒÃÇ¿ÉÒÔÌṩÎȶ¨µÄ£¬Àι̵ģ¬¿ÉÓÃÓÚÉ - ú²úʹÓõİ汾¡£ÎÒÃÇÏàÐÅÔÚÕâ·½ÃæÎÒÃÇÓëÆäËûµÄÊý¾Ý¿âÈí¼þÊÇÏ൱µÄ¡£ + ²âÊÔʱ¼ä£¬²¢ÇÒÎÒÃǵķ¢²¼ÀúÊ·ÏÔʾÎÒÃÇ¿ÉÒÔÌṩÎȶ¨µÄ£¬Àι̵ģ¬¿ÉÓ + ÃÓÚÉú²úʹÓõİ汾¡£ÎÒÃÇÏàÐÅ + ÔÚÕâ·½ÃæÎÒÃÇÓëÆäËûµÄÊý¾Ý¿âÈí¼þÊÇÏ൱µÄ¡£ Ö§³Ö ÎÒÃǵÄÓʼþÁбíÌṩһ¸ö·Ç³£´óµÄ¿ª·¢ÈËÔ±ºÍÓû§µÄ×éÒÔ°ïÖú½â¾öËùÅöµ - ½µÄÈκÎÎÊÌâ¡£ÎÒÃDz»Äܱ£Ö¤¿Ï¶¨Äܽâ¾öÎÊÌ⣬Ïà±È֮ϣ¬ÉÌÓà DBMS - Ò²²¢²»ÊÇ×ÜÄܹ»Ìṩ½â¾ö·½·¨¡£Ö±½ÓÓ뿪·¢ÈËÔ±£¬Óû§Èº£¬ÊÖ²áºÍÔ´³ÌÐ - ò½Ó´¥Áî PostgreSQL µÄÖ§³Ö±ÈÆäËû DBMS + ½µÄÈκÎÎÊÌâ¡£ ÎÒÃDz»Äܱ£Ö¤¿Ï¶¨Äܽâ¾öÎÊÌ⣬Ïà±È֮ϣ¬ÉÌÓà DBMS + Ò²²¢²»ÊÇ×ÜÄܹ»Ìṩ½â¾ö·½·¨¡£ + Ö±½ÓÓ뿪·¢ÈËÔ±£¬Óû§Èº£¬ÊÖ²áºÍÔ´³ÌÐò½Ó´¥Áî PostgreSQL + µÄÖ§³Ö±ÈÆäËû DBMS »¹ÒªºÃ¡£»¹ÓÐһЩÉÌÒµÐÔµÄÔ¤°ü×°µÄÖ§³Ö£¬¿ÉÒÔ¸øÌṩ¸øÄÇЩÐèÒªµÄÈË¡ - ££¨²ÎÔÄÖ§³Ö FAQ Ìõ¿î 1.6 С½Ú¡££© + ££¨²ÎÔÄ FAQ Ìõ¿î 1.5 С½Ú£© ¼Û¸ñ - ÎÒÃǶÔÈκÎÓÃ;¶¼Ãâ·Ñ£¬°üÀ¨ÉÌÓúͷÇÉÌÓÃÄ¿µÄ¡£Äã¿ÉÒÔ²»¼ÓÏÞÖƵØÏòÄ - ãµÄ²úÆ·Àï¼ÓÈëÎÒÃǵĴúÂ룬³ýÁËÄÇЩÎÒÃÇÔÚÉÏÃæµÄ°æȨÉùÃ÷ÀïÉùÃ÷µÄ - BSD ·ç¸ñµÄ°æȨÍâ¡£ + ÎÒÃǶÔÈκÎÓÃ;¶¼Ãâ·Ñ£¬°üÀ¨ÉÌÓúͷÇÉÌÓÃÄ¿µÄ¡£ + Äã¿ÉÒÔ²»¼ÓÏÞÖƵØÏòÄãµÄ²úÆ·Àï¼ÓÈëÎÒÃǵĴúÂ룬³ýÁËÄÇЩÎÒÃÇÔÚÉÏÃæµ + Ä°æȨÉùÃ÷ÀïÉùÃ÷µÄ BSD ·ç¸ñµÄ°æȨÍâ¡£ - 1.15) ÎÒÓ¦¸ÃÔõÑùÔÞÖú PostgreSQL £¿ - - ×Ô´Ó1996Ä꿪ʼ£¬PostgreSQL ÒѾÓÐÁËÒ»¸öÓÅÐãµÄ×éÖ¯¡£ÕâЩӦ¸Ã¹é¹¦ÓÚ Marc - Fournier£¬ÊÇËû´´½¨Á˲¢ÔÚÕâЩÄêÒ»Ö±¹ÜÀíÕâ¸ö×éÖ¯¡£ - - ¶ÔÓÚÒ»¸ö¿ªÔ´ÏîÄ¿À´Ëµ£¬ÖÊÁ¿»ù´¡ÉèÊ©ÊǷdz£ÖØÒªµÄ¡£ËüÄÜ·ÀÖ¹³öÏÖÑÏÖØÑÓ³ÙÏî - Ä¿Ç°½øµÄ»ìÂÒ¡£ - - ÏÔÈ»£¬Õâ¸ö×éÖ¯µÄÔËת³É±¾²»·Æ¡£Î¬³ÖÆäÇ°½øÓи÷ÖÖÔ¶ȵġ¢Ò»´ÎÐԵĿªÖ§¡£Èç - ¹ûÄã»òÕßÄãµÄ¹«Ë¾ÄܽøÐоèÔùÒÔÖ§³ÖÕâÏîÊÂÒµ£¬Çë·ÃÎÊ - http://store.pgsql.com/shopping/ ½øÐоèÔù¡£ - - ËäÈ»¸ÃÍøÒ³Ìá¼°ÁË PostgreSQL ¹«Ë¾£¬ÕâЩ¾èÔù½«½öÓÃÓÚÖ§³Ö PostgreSQL - ÏîÄ¿£¬²¢²»»áÓÃÓÚ×ÊÖúû¸öÌض¨µÄ¹«Ë¾¡£Èç¹ûÄãÔ¸Ò⣬Ҳ¿ÉÒÔÓʼÄ֧Ʊµ½ÁªÏµµØ - Ö·¡£ + 1.13)Ë¿ØÖÆPostgreSQL £¿ + + Èç¹ûÄãÔÚÑ°ÕÒPostgreSQLµÄÕÆÃÅÈË£¬»òÊÇʲôÖÐÑëίԱ»á£¬»òÊÇʲôËùÊô¹«Ë¾£¬ + ÄãÖ»ÄÜ·ÅÆúÁË---ÒòΪһ¸öÒ²²»´æÔÚ£¬µ«ÎÒÃǵÄÈ·ÓÐÒ»¸ö + ίԱ»áºÍCVS¹ÜÀí×飬µ«ÕâЩ¹¤×÷×éµÄÉèÁ¢Ö÷ÒªÊÇΪÁ˽øÐйÜÀí¹¤×÷¶ø²»ÊǶÔPos + tgreSQL½øÐпØÖÆ£¬PostgreSQLÏîÄ¿ÊÇÓÉÈκÎÈ˾ù + ¿É²Î¼ÓµÄ¿ª·¢ÈËÔ±ÉçÇøºÍËùÓÐÓû§¿ØÖƵģ¬ÄãËùÐèÒª×öµÄ¾ÍÊǼÓÈëÓʼþÁÐ±í£¬²Î + ÓëÌÖÂÛ¼´¿É£¨Òª²ÎÓëPostgreSQLµÄ¿ª·¢Ïê¼û Developer's FAQ »ñÈ¡ÐÅÏ¢£©¡£ _________________________________________________________________ - Óû§¿Í»§¶ËÎÊÌâ - - 2.1) ÓÐ PostgreSQL µÄ ODBC Çý¶¯Ã´£¿ +Óû§¿Í»§¶ËÎÊÌâ + + 2.1)ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL ´ò½»µÀ£¿ - ÓÐÁ½¸ö ODBC Çý¶¯¿ÉÒÔ»ñµÃ£¬PsqlODBC ºÍ OpenLink ODBC. - - ¿ÉÒÔÔÚhttp://gborg.postgresql.org/project/psqlodbc/projdisplay.php - ÏÂÔØ PsqlODBC ¡£ + PostgreSQL(ȱʡÇé¿ö)Ö»°²×°ÓÐCºÍÄÚǶʽCµÄ½Ó¿Ú£¬ÆäËûµÄ½Ó¿Ú¶¼ÊǶÀÁ¢µÄÏîÄ¿ + £¬Äܹ»·Ö±ðÏÂÔØ£¬ÕâЩ½Ó¿ÚÏîÄ¿¶ÀÁ¢µÄºÃ´¦ + ÊÇËûÃÇ¿ÉÒÔÓи÷×Եķ¢²¼¼Æ»®ºÍ¸÷×Ô¶ÀÁ¢µÄ¿ª·¢×é¡£ - OpenLink ODBC ¿ÉÒÔ´Ó http://www.openlinksw.com/ »ñµÃ¡£ËüÓëËûÃǵıê×¼ - ODBC ¿Í»§¶ËÈí¼þ¼æÈÝ£¬Òò¶øÄã¿ÉÒÔÔÚÈκÎËûÃÇÖ§³ÖµÄ¿Í»§¶Ëƽ̨£¨Win, Mac, - Unix, VMS£©ÉÏʹÓà PostgreSQL ODBC¡£ + һЩ±à³ÌÓïÑÔÈçPHP¶¼ÓзÃÎÊ PostgreSQL + µÄ½Ó¿Ú£¬Perl,TCL,PythonÒÔ¼°ºÜ¶àÆäËûÓïÑԵĽӿÚÔÚ + http://gborg.postgresql.org ÉϵÄDrivers/InterfacesС½Ú¿ÉÕÒµ½£¬ + ²¢ÇÒͨ¹ýInternetºÜÈÝÒ×ËÑË÷µ½¡£ - ËûÃÇ¿ÉÄܽ«Õâ¸ö²úÆ·ÏúÊÛ¸øÄÇЩÐèÒªÉÌÒµÖ§³ÖµÄÓû§£¬µ«ÊÇ×ÜÊÇÓÐÒ»¸ö - freeware £¨×ÔÓÉÈí¼þ£©µÄ°æ±¾¿ÉÒԵõ½¡£ÇëѯÎÊ - postgres95@openlink.co.uk¡£ - - 2.2) ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web Ò³Ã棿 + 2.2)ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web Ò³Ã棿 - Ò»¸ö½éÉÜÒÔÊý¾Ý¿âΪºǫ́µÄͦ²»´íµÄ Õ¾µãÊÇ£ºhttp://www.webreview.com ¡£ + Ò»¸ö½éÉÜÒÔÊý¾Ý¿âΪºǫ́µÄͦ²»´íµÄÕ¾µãÊÇ£ºhttp://www.webreview.com¡£ - ¶ÔÓÚ Web ¼¯³É£¬PHP ÊÇÒ»¸ö¼«ºÃµÄ½Ó¿Ú¡£ËüÔÚ£ºhttp://www.php.net/ ¡£ + ¶ÔÓÚ Web ¼¯³É£¬PHP ÊÇÒ»¸ö¼«ºÃµÄ½Ó¿Ú¡£ËüÔÚ£ºhttp://www.php.net/¡£ ¶ÔÓÚ¸´ÔÓµÄÈÎÎñ£¬ºÜ¶àÈ˲ÉÓà Perl ½Ó¿ÚºÍ CGI.pm »ò mod_perl ¡£ - 2.3) PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂ𣿠- - Êǵġ£Óм¸¸öÊÊÓÃÓÚ PostgreSQL - µÄͼÐνӿڡ£°üÀ¨PgAccess£¨http://www.pgaccess.com)£¬PgAdmin II - £¨http://www.pgadmin.org£¬½öÊÊÓÃÓÚWin32£©£¬ RHDB Admin - (http://sources.redhat.com/rhdb/£© ÒÔ¼° Rekall - £¨http://www.thekompany.com/products/rekall/£¬ - רÓеÄ/proprietary)¡£»¹ÓÐPHPPgAdmin - £¨http://phppgadmin.sourceforge.net/£© £¬Ò»¸ö»ùÓÚ web µÄ PostgreSQL - ·ÃÎʽӿڡ£ - - ÎÒÃÇÓÐÒ»¸ö²»´íµÄͼÐÎÓû§½çÃ棬³ÆΪ PgAccess - £¬ËüÒ²¿ÉÒÔÓÃ×÷±¨±íÉú³ÉÆ÷¡£ÍøÒ³ÊÇ http://www.pgaccess.org/¡£ - - 2.4) ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL ´ò½»µÀ£¿ + 2.3)PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂ𣿠- ´ó¶àÊýÁ÷Ðеıà³ÌÓïÑÔ¶¼ÓзÃÎÊ PostgreSQL - µÄ½Ó¿Ú¡£Çë¼ì²é±à³ÌÓïÑÔµÄÀ©Õ¹Ä£¿éÁÐ±í¡£ - - PostgreSQL ·¢²¼°üÖаüº¬ÁËÒÔϽӿڣº - * C (libpq) - * Embedded C (ecpg) - * Java (jdbc) - * Python (PyGreSQL) - * TCL (libpgtcl) - - ÆäËûµÄ½Ó¿ÚÔÚ http://gborg.postgresql.org É쵀 Drivers/Interfaces - С½Ú¡£ + Êǵģ¬ÔÚ + http://techdocs.postgresql.org/guides/GUIToolsÓÐÒ»¸öÏêϸµÄÁÐ±í¡£ _________________________________________________________________ - ϵͳ¹ÜÀíÎÊÌâ - - 3.1) ÎÒÔõÑùÄÜ°Ñ PostgreSQL ×°ÔÚ /usr/local/pgsql ÒÔÍâµÄµØ·½£¿ +ϵͳ¹ÜÀíÎÊÌâ + + 3.1)ÎÒÔõÑùÄÜ°Ñ PostgreSQL ×°ÔÚ /usr/local/pgsql ÒÔÍâµÄµØ·½£¿ ÔÚÔËÐÐ configure ʱ¼ÓÉÏ --prefix Ñ¡Ïî¡£ - 3.2) µ±ÎÒÔËÐÐ postmaster ʱ£¬³öÏÖ Bad System Call£¨ÏµÍ³µ÷ÓÃ´í£©»ò Core - Dumped ´íÎó¡£ÎªÊ²Ã´£¿ - - Õâ¿ÉÄÜÊǺܶ෽ÃæµÄÎÊÌ⣬ÇëÏȼì²é²Ù×÷ϵͳºËÐÄÊÇ·ñÖ§³Ö System V - À©Õ¹¡£PostgreSQL ÐèÒªÄÚºËÖ§³Ö¹²ÏíÄÚ´æºÍÐźŵơ£ - - 3.3) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ IpcMemoryCreate ´íÎó¡£ÎªÊ²Ã´£¿ + 3.2)ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿ - ÄãҪôÊÇûÓÐÔÚÄÚºËÀïÕýÈ·ÅäÖù²ÏíÄڴ棬ҪôÊÇÄãÐèÒªÀ©´óÄãµÄÄں˵ĿÉÓù² - ÏíÄÚ´æ¡£ÐèÒªµÄ¹²ÏíÄÚ´æ¾ßÌåµÄÊýÁ¿È¡¾öÓÚÄãµÄÌåϵ½á¹¹ºÍÄãÅäÖÃÄãµÄ - postmaster - ÔËÐÐʱʹÓõĻº³åÇøºÍºó¶Ë½ø³ÌÊýÄ¿¡£¶Ô´ó¶àÊýϵͳ£¬Ê¹ÓÃȱʡ»º³åÇøºÍ½ø³ÌÊý - Ŀʱ£¬Äã×îÉÙÐèÒª~1MB¡£Óйع²ÏíÄÚ´æºÍÐźŵƵÄÏêϸÐÅÏ¢Çë²Î¿¼ PostgreSQL - Administrator's Guide ¡£ + ȱʡʱ£¬PostgreSQL Ö»ÔÊÐíͨ¹ý unix + ÓòÌ×½Ó×Ö»òTCP/IP·½Ê½ÇÒÀ´×Ô±¾»úµÄÁ¬½Ó¡£ + ÄãÖ»ÓÐÔÚÐÞ¸ÄÁËÅäÖÃÎļþpostgresql.confÖеÄlisten_addresses£¬ÇÒÒ²ÔÚÅäÖÃÎ + ļþpg_hba.confÖдò¿ªÁË Ö÷»úΪ»ù´¡£¨ host-based + £©µÄÉí·ÝÈÏÖ¤£¬²¢ÖØÐÂÆô¶¯PostgreSQL£¬·ñÔòÆäËû»úÆ÷ÊDz»ÄÜÓëÄãµÄPostgreSQL + ·þÎñÆ÷Á¬½ÓµÄ¡£ - 3.4) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ IpcSemaphoreCreate ´íÎó¡£ÎªÊ²Ã´£¿ + 3.3)ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿ - Èç¹û´íÎóÐÅÏ¢ÊÇ IpcSemaphoreCreate: semget failed (No space left on - device)£¬ÄÇôÔÒòÊÇÄãµÄÄÚºËûÓÐÅäÖÃ×ã¹»µÄÐźŵÆ×ÊÔ´¡£Postgres - µÄÿ¸öDZÔڵĺǫ́½ø³Ì¶¼ÐèÒªÒ»¸öÐźŵơ£Ò»¸öÁÙʱµÄ½â¾ö·½·¨ÊÇÒԱȽÏÉٵĺó - ̨½ø³ÌÊý£¨²ÎÊý£©Æô¶¯ postmaster¡£Ê¹Óÿª¹Ø -N ´øÒ»¸öÉÙÓÚȱʡֵ 32 - µÄ²ÎÊýÔËÐÐ postmaster¡£¸ü³¤¾ÃµÄ½â¾ö·½·¨ÊǼӴóÄãµÄÄÚºËµÄ SEMMNS ºÍ - SEMMNI ²ÎÊý¡£ - - ÔÚÊý¾Ý¿â·ÃÎÊÁ¿ºÜ´óʱ£¬ÐźŵƲ»¿ÉÓÿÉÄܵ¼ÖÂϵͳ±ÀÀ£¡£ + ÓÐÈý¸öÖ÷Òª·½Ãæ¿ÉÒÔÌáÉýPostgreSQLµÄDZÄÜ¡£ - Èç¹û´íÎóÐÅÏ¢ÊÇÆäËûµÄʲô¶«Î÷£¬Äã¿ÉÄܾ͸ù±¾Ã»ÓÐÔÚÄÚºËÀïÃæÅäÖÃÐźŵÆÖ§³Ö - ¡£Óйع²ÏíÄÚ´æºÍÐźŵƵÄÏêϸÐÅÏ¢Çë²Î¿¼ PostgreSQL Administrator's - Guide ¡£ - - 3.5) ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿ + ²éѯ·½Ê½µÄ±ä»¯ + ÕâÖ÷ÒªÉæ¼°Ð޸IJéѯ·½Ê½ÒÔ»ñÈ¡¸üºÃµÄÐÔÄÜ: + + + ´´½¨Ë÷Òý£¬°üÀ¨±í´ïʽºÍ²¿·ÖË÷Òý£» + + ʹÓÃCOPYÓï¾ä´úÌæ¶à¸öInsertÓï¾ä£» + + ½«¶à¸öSQLÓï¾ä×é³ÉÒ»¸öÊÂÎñÒÔ¼õÉÙÌá½»ÊÂÎñµÄ¿ªÏú£» + + ´ÓÒ»¸öË÷ÒýÖÐÌáÈ¡¶àÌõ¼Ç¼ʱʹÓÃCLUSTER£» + + ´ÓÒ»¸ö²éѯ½á¹ûÖÐÈ¡³ö²¿·Ö¼Ç¼ʱʹÓÃLIMIT£» + + ʹÓÃÔ¤±àÒëʽ²éѯ£¨Prepared Query)£» + + ʹÓÃANALYZEÒÔ±£³Ö¾«È·µÄÓÅ»¯Í³¼Æ£» + + ¶¨ÆÚʹÓà VACUUM »ò pg_autovacuum + + ½øÐдóÁ¿Êý¾Ý¸ü¸ÄʱÏÈɾ³ýË÷Òý£¨È»ºóÖؽ¨Ë÷Òý£© + + ·þÎñÆ÷µÄÅäÖà + ÅäÖÃÎļþpostgres.confÖеĺܶàÉèÖö¼»áÓ°ÏìÐÔÄÜ£¬ËùÓвÎÊýµÄÁбí¿É + ¼û£º Administration Guide/Server Run-time Environment/Run-time + Configuration£¬ ÓйزÎÊýµÄ½âÊͿɼû£º + http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_co + nf_e.html ºÍ + http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html¡£ + + Ó²¼þµÄÑ¡Ôñ + ¼ÆËã»úÓ²¼þ¶ÔÐÔÄܵÄÓ°Ïì¿Éä¯ÀÀ + http://candle.pha.pa.us/main/writings/pgsql/hw_performance/inde + x.html ºÍ http://www.powerpostgresql.com/PerfList/¡£ + + 3.4)PostgreSQL Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿ - ȱʡʱ£¬PostgreSQL Ö»ÔÊÐíͨ¹ý unix ÓòÌ×½Ó×ÖÀ´×Ô±¾»úµÄÁ¬½Ó¡£³ý·ÇÄãʹÓà - -i ¿ª¹ØÆô¶¯ postmaster£¬²¢ÇÒͨ¹ý¶ÔÓ¦µÄ±à¼ $PGDATA/pg_hba.conf - Îļþ´ò¿ªÁËÖ÷»úΪ»ù´¡£¨ host-based - £©µÄÈÏÖ¤£¬·ñÔòÆäËû»úÆ÷ÊDz»ÄÜÓëÄãµÄ»úÆ÷Á¬½ÓµÄ¡£ÕâÑù½«ÔÊÐí TCP/IP Á¬½Ó¡£ + PostgreSQL ÓкܶàÀàËÆ log_* + µÄ·þÎñÆ÷ÅäÖñäÁ¿¿ÉÓÃÓÚ²éѯµÄ´òÓ¡ºÍ½ø³Ìͳ¼Æ£¬¶øÕâЩ¹¤×÷¶Ôµ÷ÊÔºÍÐÔÄܲâÊÔ + ºÜÓаïÖú¡£ - 3.6) ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿ + 3.5)ΪʲôÔÚÊÔͼÁ¬½ÓʱÊÕµ½¡°Sorry, too many clients¡±ÏûÏ¢£¿ - µ±È»£¬Ë÷Òý¿ÉÒÔ¼ÓËÙ²éѯ¡£EXPLAIN ÃüÁîÔÊÐíÄã¹Û²ì PostgreSQL - ÈçºÎ½âÊÍÄãµÄ²éѯ£¬ÒÔ¼°Ê¹ÓÃÁËÄÄЩË÷Òý¡£ + Õâ±íʾÄãÒѴﵽȱʡ100¸ö²¢·¢ºǫ́½ø³ÌÊýµÄÏÞÖÆ£¬ÄãÐèҪͨ¹ýÐÞ¸Äpostgresql. + confÎļþÖеÄmax_connectionsÖµÀ´ + Ôö¼ÓpostmasterµÄºǫ́²¢·¢´¦ÀíÊý£¬Ð޸ĺóÐèÖØÐÂÆô¶¯postmaster¡£ - Èç¹ûÄãÕý´¦ÀíÒ»¶Ñ INSERT£¬¿¼ÂÇʹÓà COPY - ÃüÁîÒÔ´óÅúÁ¿µÄ·½Ê½½øÐС£ÕâÑù×ö±Èµ¥¶ÀµÄÒ»¸ö¸ö INSERT - ¿ìµÃ¶à¡£Æä´Î£¬Ã»Óд¦ÓÚ BEGIN WORK/COMMIT - ÊÂÎñ¿éÖ®¼äµÄÓï¾ä±»ÈÏΪÊôÓÚͬһ¸öÊÂÎñ¡£ÊÔ×ÅÔÚÒ»¸öÊÂÎñ¿éÀïÃæ´¦Àí¸ü¶àµÄÓï - ¾ä¡£ÕâÑù¿ÉÒÔ¼õÉÙÊÂÎñ´øÀ´µÄ¶îÍ⿪Ïú¡£Í¬Ñù£¬ÔÚ×ö´óÁ¿µÄÊý¾Ý¸Ä±äʱ¿¼ÂÇɾ³ý - ºÍÖؽ¨Ë÷Òý¡£ - - »¹Óм¸¸öµ÷½ÚµÄÑ¡Ïî¿ÉÒÔʹÓá£Äã¿ÉÒÔͨ¹ý´ø -o -F Ñ¡ÏîÆô¶¯ postmaster - À´½ûÖ¹ fsync()¡£ÕâÑù½«±ÜÃâÿ´ÎÊÂÎñºóµ÷Óà fsync() °ÑÊý¾Ýˢе½´ÅÅÌÉÏ¡£ - - Ä㻹¿ÉÒÔʹÓà postmaster -B - Ñ¡ÏîÔö¼Óºó¶Ë½ø³ÌʹÓõĹ²ÏíÄڴ滺³åµÄÊýÄ¿¡£Èç¹ûÄã°ÑÕâ¸ö²ÎÊýÉèÖõÃÌ«´ó£¬ - postmaster ¿ÉÄÜÎÞ·¨Æô¶¯£¬ÒòΪÄãÒѾ­ - ³¬¹ýÁËÄãµÄÄÚºËÔÚ¹²ÏíÄÚ´æ¿Õ¼äÉϵÄÏÞÖÆ¡£Ã¿¸ö»º³åÇøÊÇ 8K ²¢ÇÒȱʡ 64 - ¸ö»º³åÇø¡£ - - Ä㻹¿ÉÒÔʹÓúǫ́½ø³ÌµÄ -S - Ñ¡ÏîÀ´Ôö¼Óÿ¸öºǫ́½ø³ÌÓÃÓÚÁÙʱÅÅÐòÓõÄ×î´óÄÚ´æÊýÁ¿¡£-S - ÖµÊÇÒÔK×ֽڼƵģ¬È±Ê¡ÊÇ 512 £¨Ò²¾ÍÊÇ˵£¬512K£©¡£ - - Ä㻹¿ÉÒÔʹÓà CLUSTER ÃüÁîÀ´°Ñ±íÀïµÄÊý¾Ý°´ÕÕij¸öË÷Òý½øÐоۼ¯´æ·Å¡£²ÎÔÄ - CLUSTER µÄÊÖ²áÒ³»ñÈ¡¸ü¶àϸ½Ú¡£ - - 3.7) PostgreSQL Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿ + 3.6)ΪʲôҪÔÚÉý¼¶ PostgreSQL Ö÷Òª·¢²¼°æ±¾Ê±×ö dump ºÍ restore £¿ - PostgreSQL - Óм¸¸öÌØÐÔÓÃÓÚ±¨¸æ״̬ÐÅÏ¢£¬ÕâЩÐÅÏ¢¿ÉÄܶԵ÷ÊÔÓÃ;ºÜÓаïÖú¡£ - - Ê×ÏÈ£¬Í¨¹ý¸½´ø --enable-cassert Ñ¡ÏîÔËÐÐ configure£¬Óкܶà assert() - ¼à¿Øºǫ́½ø³ÌºÍÔÚ·¢ÉúijЩδÔøÔ¤ÁϵÄÏÖÏóʱֹͣ³ÌÐòÔËÐС£ - - postmaster ºÍ postgres ¶¼ÓÐһЩ¿ÉÓõÄÑ¡Ïî¡£Ê×ÏÈ£¬µ±ÄãÆô¶¯ postmaster - ʱ£¬È·±£Äã°Ñ±ê×¼Êä³öºÍ±ê×¼´íÎóÊä³ö¶¨Ïòµ½ÁËÒ»¸öÈÕÖ¾ÎļþÀïÈ¥ÁË£¬Ïó£º - cd /usr/local/pgsql - ./bin/postmaster >server.log 2>&1 & - - ÕâÑù½«ÔÚ PostgreSQL ¶¥¼¶Ä¿Â¼ÏÂÊä³öÒ»¸ö server.log - Îļþ¡£Õâ¸öÎļþ°üº¬·þÎñÆ÷Åöµ½µÄÎÊÌâºÍ´íÎóµÄÓÐÓÃÐÅÏ¢¡£postmaster ÓÐÒ»¸ö - -d Ñ¡Ï¸ÃÑ¡ÏîÔÊÐíÎÒÃÇ»ñµÃ¸ü¶àµÄϸ½Ú»ã±¨¡£-d - Ñ¡Ïî½ÓÊÜÒ»¸öÊý×Ö±êÃ÷µ÷ÊÔ¼¶±ð¡£ÐèÒª¾¯¸æµÄÊǸߵĵ÷ÊÔ¼¶±ð¿ÉÄÜ»áÉú³É¾Þ´óµÄ - ÈÕÖ¾Îļþ¡£ - - Èç¹û postmaster ûÓÐÔËÐУ¬Äã¿ÉÒÔÖ±½ÓÔÚÃüÁîÐÐÉÏÆô¶¯ postgres - ºǫ́½ø³Ì£¬È»ºóÖ±½Ó¼üÈë SQL Óï¾ä¡£ÎÒÃÇÖ» - ÍƼöÔÚµ÷ÊÔµÄʱºòÕâô¸É¡£Çë×¢ÒâÕâʱÓû»ÐÐÜÞ¶ø²»ÊǷֺűíʾÓï¾ä½áβ¡£Èç¹û - Äã´ø×ŵ÷ÊÔ·ûºÅ±àÒ룬Äã¿ÉÒÔʹÓÃÒ»¸öµ÷ÊÔÆ÷¹Û¿´·¢ÉúÁËʲôÊÂÇé¡£ÒòΪºǫ́½ø - ³ÌûÓÐÓÉ postmaster - Æô¶¯µÄ£¬Ëü²»ÊǺÍʵ¼ÊµÄÔËÐл·¾³Ò»Ö£¬¶øÇÒËø¶¨/ºǫ́½»»¥ÎÊÌâ¿ÉÄܲ»ÄÜÖØÏÖ¡ - £ - - Èç¹û postmaster ÒѾÔËÐУ¬¿ÉÔÚÒ»¸ö´°¿ÚÖÐÆô¶¯ psql£¬È»ºóÕÒ³ö psql ¶ÔÓ¦µÄ - postgres ½ø³ÌµÄ PID¡£Ê¹ÓÃÒ»¸öµ÷ÊÔÆ÷¸½×ÅÔÚÕâ¸ö postgres PID - ÉÏ¡£Äã¿ÉÒÔÔÚµ÷ÊÔÆ÷ÀïÉèÖöϵ㲢ÇÒ´Ó psql ÀïÖ´Ðвéѯ¡£Èç¹ûÄãÔÚµ÷ÊÔ - postgres µÄÆô¶¯£¬Äã¿ÉÒÔÉèÖà PGOPTIONS="-W n"£¬È»ºóÆô¶¯ - psql¡£ÕâÑù½«µ¼ÖÂÆô¶¯ÑÓ³Ù n - Ã룬ÕâÑùÄã¾Í¿ÉÒÔ¸½¼ÓÒ»¸öµ÷ÊÔÆ÷²¢ÇÒ¸ú×ÙÆô¶¯Ë³ÐòµÄ¹ý³Ì¡£ - - postgres ³ÌÐòÓÐ -s£¬-A£¬ºÍ -t Ñ¡Ïî¿ÉÄÜÔÚµ÷ÊÔºÍÐÔÄܲâÁ¿µÄʱºò·Ç³£ÓÐÓᣠ- - Ä㻹¿ÉÒÔ´ø profiling - Ö§³Ö±àÒëºǫ́£¬ÒÔ±ã¹Û²ìÄÄЩº¯ÊýÕ¼ÓõÄÖ´ÐÐʱ¼ä½Ï¶à¡£profile Îļþ½«·ÅÔÚ - pgsql/data/base/dbname Ŀ¼Ï¡£¿Í»§¶Ë profile - Îļþ½«·ÅÔÚ¿Í»§¶Ëµ±Ç°Ä¿Â¼Ï¡£ÔÚ Linux ÏÂÖ§³Ö profiling - ÒªÔÚ±àÒëʱ¼ÓÉÏ-DLINUX_PROFILE ¡£ - - 3.8) ΪʲôÔÚÊÔͼÁ¬½ÓµÇ¼ʱÊÕµ½¡°Sorry, too many clients¡±ÏûÏ¢£¿ - - ÄãÐèÒªÔö´ó postmaster Æô¶¯Ê±Ö§³ÖµÄ²¢·¢ºǫ́½ø³ÌÊý¡£ - - ȱʡÏÞÖÆÊÇ 32 ½ø³Ì¡£Äã¿ÉÒÔͨ¹ý´ø×ÅÊʵ±µÄ -N Öµ¿ª¹ØÆô¶¯ postmaster - Ôö¼ÓÕâ¸öÊýÄ¿¡£»òÕßÐÞ¸Ä postgresql.conf Îļþ¡£ - - ҪעÒâÈç¹ûÄã°Ñ -N ÉèÖÃΪ´óÓÚ 32£¬Äã±ØÐëͬÑùÔö´ó -B£¬³¬¹ýËüȱʡµÄ - 64£»-B ±ØÐë×îÉÙÊÇ -N - µÄÁ½±¶£¬¶øÇÒΪÁ˸üºÃµÄÐÔÄÜ¿ÉÄÜÒª±ÈÄǸöÊý×ÖÒª´ó¡£¶ÔÓÚ´óÊýÄ¿µÄºó¶Ë½ø³Ì£¬ - Äã¿ÉÄÜ»¹»á·¢ÏÖÄ㻹ÐèÒªÔö¼ÓÐí¶à Unix - ÄÚºËÅäÖòÎÊýÖµ¡£Òª¼ì²éµÄ¶«Î÷°üÀ¨¹²ÏíÄÚ´æ¿éµÄ×î´ó³ß´ç£¬SHMMAX£¬ÐÅºÅµÆµÄ - ×î´óÊýÄ¿£¬SEMMNS ºÍ - SEMMNI£¬×î´óµÄ½ø³ÌÊý£¬NPROC£¬µ¥Óû§×î´ó½ø³ÌÊý£¬MAXUPRC£¬ÒÔ¼°´ò¿ªÎļþµÄ - ×î´óÊýÄ¿£¬NFILE ºÍ NINODE ¡£Postgres ¶ÔÔÊÐíµÄºǫ́½ø³ÌÊýÓÐÏÞÖƵÄÔ­ - ÒòÊÇΪÁËÈ·±£ÄãµÄϵͳ²»»áÓùâ×ÊÔ´¡£ - - ÔÚ Postgres ÔçÓÚ 6.5 µÄ°æ±¾£¬×î´óºǫ́½ø³ÌÊýȱʡÊÇ - 64£¬²¢ÇÒ¶ÔËüµÄÐÞ¸ÄÊ×ÏÈÐèÒªÐÞ¸Ä include/storage/sinvaladt.h ÀïµÄ - MaxBackendId ³£Á¿£¬È»ºóÖØРBUILD¡£ - - 3.9) pgsql_tmp Ŀ¼ÀﶼÓÐЩʲô£¿ - - ¸ÃĿ¼Ï±£´æÁ˲éѯִÐÐÆ÷Éú³ÉµÄÁÙʱÎļþ¡£ÀýÈ磬Èç¹ûÐèҪΪÂú×ã ORDER BY - Ìõ¼þ×öÅÅÐò£¬²¢ÇÒÅÅÐòÐèÒª±Èºǫ́µÄ -S - ²ÎÊý¸ø³öµÄ¸ü¶àµÄ¿Õ¼ä£¬ÄÇô¾Í»á´´½¨Ò»¸öÁÙʱÎļþ±£´æ¶à³öÀ´µÄÊý¾Ý¡£ - - ÁÙʱÎļþÓ¦¸Ã×Ô¶¯É¾³ý£¬²»¹ýÈç¹ûÔÚÅÅÐò¹ý³ÌÖкǫ́±ÀÀ£Á˾ͿÉÄÜÁôÏÂÀ´¡£Í£Ö¹ - ²¢ÖØÆð postmaster ½«»áɾ³ýÕâЩÎļþ¡£ - - 3.10) ΪʲôҪÔÚÉý¼¶ PostgreSQL ·¢²¼°æ±¾Ê±×ö dump ºÍ restore £¿ - - PostgreSQL ¿ª·¢×é¶Ôÿ´ÎСµÄÉý¼¶½ö×öÁ˽ÏÉÙµÄÐÞ¸Ä,Òò´Ë´Ó 7.2 Éý¼¶µ½ - 7.2.1 ²»ÐèÒª dump ºÍ restore¡£µ«ÊÇÖ÷ÒªµÄÉý¼¶£¨ÀýÈç´Ó 7.2 µ½ - 7.3£©Í¨³£»áÐÞ¸Äϵͳ±íºÍÊý¾Ý±íµÄÄÚ²¿¸ñʽ¡£ÕâЩ±ä»¯Ò»°ã±È½Ï¸´ÔÓ£¬Òò´ËÎÒà - Dz»Î¬Êý¾ÝÎļþµÄÏòºó¼æÈÝ¡£dump + PostgreSQL ¿ª·¢×é¶Ôÿ´ÎСµÄÉý¼¶½ö×öÁ˽ÏÉÙµÄÐ޸ģ¬Òò´Ë´Ó 7.4.0 Éý¼¶µ½ + 7.4.1 ²»ÐèÒª dump ºÍ restore¡£ µ«ÊÇÖ÷ÒªµÄÉý¼¶£¨ÀýÈç´Ó 7.3 µ½ + 7.4£©Í¨³£»áÐÞ¸Äϵͳ±íºÍÊý¾Ý±íµÄÄÚ²¿¸ñʽ¡£ + ÕâЩ±ä»¯Ò»°ã±È½Ï¸´ÔÓ£¬Òò´ËÎÒÃDz»Î¬Êý¾ÝÎļþµÄÏòºó¼æÈÝ¡£ dump ½«Êý¾Ý°´ÕÕͨÓõĸñʽÊä³ö£¬Ëæºó¿ÉÒÔ±»ÖØмÓÔز¢Ê¹ÓÃеÄÄÚ²¿¸ñʽ¡£ - ´ÅÅÌÎļþ¸ñʽûÓб仯µÄÉý¼¶£¬¿ÉÒÔÓà pg_upgrade ½Å±¾£¬¶ø²»ÐèÒª×ö dump ºÍ - restor¡£·¢²¼ËµÃ÷script »áÖ¸Ã÷ pg_upgrade ¶Ô¸Ã´ÎÉý¼¶ÊÇ·ñ¿ÉÓᣠ+ 3.7)(ʹÓÃPostgreSQL)ÎÒÐèҪʹÓÃʲô¼ÆËã»úÓ²¼þ £¿ + + ÓÉÓÚ¼ÆËã»úÓ²¼þ´ó¶àÊýÊǼæÈݵģ¬ÈËÃÇ×ÜÊÇÇãÏòÓÚÏàÐÅËùÓмÆËã»úÓ²¼þÖÊÁ¿Ò²ÊÇ + ÏàͬµÄ¡£ÊÂʵÉϲ»ÊÇ£¬ ECC RAM£¨´øÆæżУÑéµÄÄڴ棩£¬SCSI + £¨Ó²ÅÌ£©ºÍÓÅÖʵÄÖ÷°å±ÈһЩ±ãÒË»õÒª¸ü¼Ó¿É¿¿ÇÒ¾ßÓиüºÃµÄÐÔÄÜ¡£PostgreSQL + ¼¸ºõ¿ÉÒÔÔËÐÐÔÚÈκÎÓ²¼þÉÏ£¬ + µ«Èç¹û¿É¿¿ÐÔºÍÐÔÄܶÔÄãµÄϵͳºÜÖØÒª£¬Äã¾ÍÐèҪȫÃæµÄÑо¿Ò»ÏÂÄãµÄÓ²¼þÅäÖà + ÁË¡£ÔÚÎÒÃǵÄÓʼþÁбíÉÏÒ²ÓйØÓÚ Ó²¼þÅäÖúÍÐԼ۱ȵÄÌÖÂÛ¡£ _________________________________________________________________ - ²Ù×÷ÎÊÌâ - - 4.1) ¶þ½øÖÆÓαêºÍÆÕͨÓαêÖ®¼äµÄÇø±ðÊÇʲô£¿ +²Ù×÷ÎÊÌâ + + 4.1)ÈçºÎֻѡÔñÒ»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿»òÊÇËæ»úµÄÒ»ÐУ¿ + + Èç¹ûÄãÖ»ÊÇÒªÌáÈ¡¼¸ÐÐÊý¾Ý£¬²¢ÇÒÄãÔÚÖ´ÐвéѯÖÐÖªµÀÈ·ÇеÄÐÐÊý£¬Äã¿ÉÒÔʹÓà + LIMIT¹¦ÄÜ¡£ Èç¹ûÓÐÒ»¸öË÷ÒýÓë ORDER BYÖеÄÌõ¼þÆ¥Å䣬PostgreSQL + ¿ÉÄܾÍÖ»´¦ÀíÒªÇóµÄÍ·¼¸Ìõ¼Ç¼£¬ + £¨·ñÔò½«¶ÔÕû¸ö²éѯ½øÐд¦ÀíÖ±µ½Éú³ÉÐèÒªµÄÐУ©¡£Èç¹ûÔÚÖ´Ðвéѯ¹¦ÄÜʱ²»Öª + µÀÈ·ÇеļǼÊý£¬ ¿ÉʹÓÃÓαê(cursor)ºÍFETCH¹¦ÄÜ¡£ + + ¿ÉʹÓÃÒÔÏ·½·¨ÌáÈ¡Ò»ÐÐËæ»ú¼Ç¼µÄ£º + SELECT cols + FROM tab + ORDER BY random() + LIMIT 1 ; + + 4.2)ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿ÈçºÎ²é¿´psqlÀïÓõ½µÄ²éѯָÁî²¢Ï + ÔʾËüÃÇ£¿ - ²ÎÔÄ DECLARE ÊÖ²áÒ³»ñÈ¡ÐÅÏ¢¡£ + ÔÚpsqlÖÐʹÓà \dt + ÃüÁîÀ´ÏÔʾÊý¾Ý±íµÄ¶¨Ò壬ҪÁ˽âpsqlÖеÄÍêÕûÃüÁîÁбí¿ÉʹÓÃ\? + £¬ÁíÍ⣬ÄãÒ²¿ÉÒÔÔĶÁ psql µÄÔ´´úÂë + Îļþpgsql/src/bin/psql/describe.c£¬Ëü°üÀ¨ÎªÉú³Épsql·´Ð±¸ÜÃüÁîµÄÊä³öµÄË + ùÓÐ SQL ÃüÁî¡£Ä㻹¿ÉÒÔ´ø -E Ñ¡ÏîÆô¶¯ psql£¬ + ÕâÑùËü½«´òÓ¡³öÖ´ÐÐÄãÔÚpsqlÖÐËù¸ø³öµÄÃüÁîµÄÄÚ²¿Êµ¼ÊʹÓõÄSQL²éѯ¡£Postg + reSQLÒ²ÌṩÁËÒ»¸ö¼æÈÝSQLµÄINFORMATION SCHEMA½Ó¿Ú£¬ + Äã¿ÉÒÔ´ÓÕâÀï»ñÈ¡¹ØÓÚÊý¾Ý¿âµÄÐÅÏ¢¡£ - 4.2)ÈçºÎÖ» SELECT Ò»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿ - - ²ÎÔÄ FETCH ÊÖ²áÒ³£¬»òÕßʹÓà SELECT ... LIMIT.... + ÔÚϵͳÖÐÓÐһЩÒÔpg_ ´òÍ·µÄϵͳ±íÒ²ÃèÊöÁ˱íµÄ¶¨Òå¡£ - ¼´Ê¹ÄãÖ»ÐèÒª¿ªÍ·µÄ¼¸ÐУ¬Ò²»áÉæ¼°µ½Õû¸ö²éѯ¡£ÊÔ×ÅʹÓôøÓÐ ORDER BY - µÄ²éѯ¡£Èç¹ûÓÐÒ»¸öË÷ÒýÓë ORDER BY Æ¥Å䣬PostgreSQL - ¿ÉÄܾÍÖ»´¦ÀíÒªÇóµÄÍ·¼¸Ìõ¼Ç¼£¬·ñÔò½«¶ÔÕû¸ö²éѯ½øÐд¦ÀíÖ±µ½Éú³ÉÐèÒªµÄÐÐ - ¡£ + ʹÓà psql -l Ö¸Áî¿ÉÒÔÁгöËùÓеÄÊý¾Ý¿â¡£ - 4.3) ÎÒÈçºÎ»ñÈ¡Ò»¸ö±íµÄÁÐ±í£¬»òÕßÊÇÆäËûÎÒÄÜÔÚ psql Àï¿´µ½µÄ¶«Î÷£¿ - - Äã¿ÉÒÔÔĶÁ psql µÄÔ´´úÂëÎļþpgsql/src/bin/psql/describe.c - ¡£Ëü°üÀ¨ÎªÉú³É psql µÄ·´Ð±¸ÜÃüÁîµÄÊä³öµÄ SQL ÃüÁî¡£Ä㻹¿ÉÒÔ´ø -E - Ñ¡ÏîÆô¶¯ psql£¬ÕâÑùËü½«´òÓ¡³öÖ´ÐÐÄã¸ø³öµÄÃüÁîËùÓõIJéѯ¡£ + Ò²¿ÉÒÔä¯ÀÀһϠ+ pgsql/src/tutorial/syscat.sourceÎļþ£¬ËüÁоÙÁ˺ܶà¿É´ÓÊý¾Ý¿âϵͳ±íÖлñ + È¡ÐÅÏ¢µÄSELECTÓï·¨¡£ - 4.4) ÔõÑù´Ó±íÀïÃæɾ³ýÒ»ÁУ¿ + 4.3)ÈçºÎ¸ü¸ÄÒ»¸ö×ֶεÄÊý¾ÝÀàÐÍ£¿ - 7.3 ÀïÔö¼ÓÁË ALTER TABLE DROP - COLUMN£¬ÒÔÖ§³Ö´ËÏÄÜ¡£ÔÚÒÔÇ°µÄ°æ±¾ÖУ¬¿ÉÒÔÕâÑù×ö£º - BEGIN; - LOCK TABLE old_table; - SELECT ... -- select all columns but the one you want to remove - INTO TABLE new_table - FROM old_table; - DROP TABLE old_table; - ALTER TABLE new_table RENAME TO old_table; + ÔÚ8.0°æ±¾Àï¸ü¸ÄÒ»¸ö×ֶεÄÊý¾ÝÀàÐͺÜÈÝÒ×£¬¿ÉʹÓà ALTER TABLE ALTER + COLUMN TYPE ¡£ + + ÔÚÒÔÇ°µÄ°æ±¾ÖУ¬¿ÉÒÔÕâÑù×ö£º + BEGIN; + ALTER TABLE tab ADD COLUMN new_col new_data_type; + UPDATE tab SET new_col = CAST(old_col AS new_data_type); + ALTER TABLE tab DROP COLUMN old_col; COMMIT; - 4.5) Ò»ÐУ¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿ + ÄãÈ»ºó¿ÉÒÔʹÓÃVACUUM FULL tab Ö¸ÁîÀ´Ê¹ÏµÍ³ÊÕ»ØÎÞЧÊý¾ÝËùÕ¼ÓõĿռ䡣 + + 4.4)Ò»ÐмǼ£¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿ ÏÂÃæÊÇһЩÏÞÖÆ£º - Ò»¸öÊý¾Ý¿â×î´ó³ß´ç£¿ ÎÞÏÞÖÆ£¨´æÔÚ 1TB µÄÊý¾Ý¿â£© - Ò»¸ö±íµÄ×î´ó³ß´ç£¿ 16TB - Ò»ÐеÄ×î´ó³ß´ç£¿ 1.6TB - Ò»¸ö×ֶεÄ×î´ó³ß´ç? 1GB - Ò»¸ö±íÀï×î´óÐÐÊý£¿ ÎÞÏÞÖÆ - Ò»¸ö±íÀï×î´óÁÐÊý£¿ ¸úÁÐÀàÐÍÓйØ,250-1600 - Ò»¸ö±íÀïµÄ×î´óË÷ÒýÊýÁ¿£¿ÎÞÏÞÖÆ - + + Ò»¸öÊý¾Ý¿â×î´ó³ß´ç£¿ ÎÞÏÞÖÆ£¨ÒÑ´æÔÚÓÐ 32TB µÄÊý¾Ý¿â£© + Ò»¸ö±íµÄ×î´ó³ß´ç£¿ 32 TB + Ò»ÐмǼµÄ×î´ó³ß´ç£¿ 1.6 TB + Ò»¸ö×ֶεÄ×î´ó³ß´ç? 1 GB + Ò»¸ö±íÀï×î´óÐÐÊý£¿ ÎÞÏÞÖÆ + Ò»¸ö±íÀï×î´óÁÐÊý£¿ 250-1600 £¨ÓëÁÐÀàÐÍÓйأ© + Ò»¸ö±íÀïµÄ×î´óË÷ÒýÊýÁ¿£¿ ÎÞÏÞÖÆ + µ±È»£¬Êµ¼ÊÉÏûÓÐÕæÕýµÄÎÞÏÞÖÆ£¬»¹ÊÇÒªÊÜ¿ÉÓôÅÅ̿ռ䡢¿ÉÓÃÄÚ´æ/½»»»ÇøµÄÖ - ÆÔ¼¡£ + ÆÔ¼¡£ ÊÂʵÉÏ£¬µ±ÕâЩÊýÖµ±äµÃÒì³£µØ´óʱ£¬ÏµÍ³ÐÔÄÜÒ²»áÊܴܺóÓ°Ïì¡£ - ±íµÄ×î´ó³ß´ç 16 TB ²»ÐèÒª²Ù×÷ϵͳ¶Ô´óÎļþµÄÖ§³Ö¡£´ó±íÓöà¸ö 1 GB + ±íµÄ×î´ó³ß´ç 32 TB ²»ÐèÒª²Ù×÷ϵͳ¶Ô´óÎļþµÄÖ§³Ö¡£´ó±íÓöà¸ö 1 GB µÄÎļþ´æ´¢£¬Òò´ËÎļþϵͳ³ß´çµÄÏÞÖÆÊDz»ÖØÒªµÄ¡£ - Èç¹ûȱʡµÄ¿é´óСÔö³¤µ½ 32K £¬×î´óµÄ±í³ß´çºÍ×î´óÁÐÊý¿ÉÒÔÔö¼Ó¡£ + Èç¹ûȱʡµÄ¿é´óСÔö³¤µ½ 32K £¬×î´óµÄ±í³ß´çºÍ×î´óÁÐÊý»¹¿ÉÒÔÔö¼Óµ½Ëı¶¡£ - 4.6)´æ´¢Ò»¸öµäÐ͵ÄƽÃæÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿 + 4.5)´æ´¢Ò»¸öµäÐ͵ÄÎı¾ÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿 Ò»¸ö Postgres - Êý¾Ý¿â×î¶à¿ÉÄÜÐèÒªÏ൱ÓÚÔÚÒ»¸öƽÃæÎļþÀï´æ´¢ÏàͬÊý¾ÝµÄ5±¶µÄ´ÅÅ̿ռ䡣 - - ÀýÈ磬¼ÙÉèÓÐÒ»¸ö 100,000 - ÐеÄÎļþ£¬Ã¿ÐÐÓÐÒ»¸öÕûÊýºÍÒ»¸öÎı¾ÃèÊö¡£¼ÙÉèÎı¾´®µÄƽ¾ù³¤¶Èλ20×Ö½Ú¡£ - ƽÃæÎļþÕ¼Óà 2.8 MB¡£´æ·ÅÕâЩÊý¾ÝµÄ PostgreSQL Êý¾Ý¿âÎļþ´óÔ¼ÊÇ 6.4 - MB: - 36 ×Ö½Ú: ÿÐеÄÍ·£¨¹À¼ÆÖµ£© - 24 ×Ö½Ú: Ò»¸öint×ֶκÍÒ»¸öÎı¾ÐÍ×ֶΠ+ Êý¾Ý¿â£¨´æ´¢Ò»¸öÎı¾Îļþ£©ËùÕ¼ÓõĿռä×î¶à¿ÉÄÜÐèÒªÏ൱ÓÚÕâ¸öÎı¾Îļþ×Ô + Éí´óС5±¶µÄ´ÅÅ̿ռ䡣 + + ÀýÈ磬¼ÙÉèÓÐÒ»¸ö 100,000 ÐеÄÎļþ£¬Ã¿ÐÐÓÐÒ»¸öÕûÊýºÍÒ»¸öÎı¾ÃèÊö¡£ + ¼ÙÉèÎı¾´®µÄƽ¾ù³¤¶ÈΪ20×Ö½Ú¡£Îı¾ÎļþÕ¼Óà 2.8 MB¡£´æ·ÅÕâЩÊý¾ÝµÄ + PostgreSQL Êý¾Ý¿âÎļþ´óÔ¼ÊÇ 6.4 MB: + 32 ×Ö½Ú: ÿÐеÄÍ·£¨¹À¼ÆÖµ£© + 24 ×Ö½Ú: Ò»¸öÕûÊýÐÍ×ֶκÍÒ»¸öÎı¾ÐÍ×ֶΠ+ 4 ×Ö½Ú: Ò³ÃæÄÚÖ¸ÏòÔª×éµÄÖ¸Õë ---------------------------------------- - 64 ×Ö½ÚÿÐÐ + 60 ×Ö½ÚÿÐÐ PostgreSQL Êý¾ÝÒ³µÄ´óСÊÇ 8192 ×Ö½Ú (8 KB)£¬Ôò£º 8192 ×Ö½Úÿҳ - ------------------- = 128 ÐÐ/Êý¾ÝÒ³£¨ÏòÏÂÈ¡Õû£© - 64 ×Ö½ÚÿÐÐ + ------------------- = 136 ÐÐ/Êý¾ÝÒ³£¨ÏòÏÂÈ¡Õû£© + 60 ×Ö½ÚÿÐÐ 100000 Êý¾ÝÐÐ - -------------------- = 782 Êý¾ÝÒ³£¨ÏòÉÏÈ¡Õû£© + -------------------- = 735 Êý¾ÝÒ³£¨ÏòÉÏÈ¡Õû£© 128 ÐÐÿҳ - 782 Êý¾ÝÒ³ * 8192 ×Ö½Ú/Ò³ = 6,406,144 ×Ö½Ú£¨6.4 MB£© + 735 Êý¾ÝÒ³ * 8192 ×Ö½Ú/Ò³ = 6,021,120 ×Ö½Ú£¨6 MB£© Ë÷Òý²»ÐèÒªÕâô¶àµÄ¶îÍâÏûºÄ£¬µ«Ò²È·Êµ°üÀ¨±»Ë÷ÒýµÄÊý¾Ý£¬Òò´ËËüÃÇÒ²¿ÉÄÜºÜ ´ó¡£ - ¿ÕÖµ´æ·ÅÔÚλͼÖУ¬Òò´ËÕ¼ÓúÜÉٵĿռ䡣 - - 4.7) ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿 - - psql ÓÐÐí¶à·´Ð±¸ÜÃüÁîÓÃÓÚÏÔʾÕâЩÐÅÏ¢¡£Óà \? ¿´¿´¶¼ÓÐÄÄЩ¡£ÒÔ pg_ - ´òÍ·µÄϵͳ±íÒ²ÃèÊöÁËÕâЩÐÅÏ¢¡£ psql -l ¿ÉÒÔÁгöËùÓеÄÊý¾Ý¿â¡£ - - Ò²¿ÉÒÔÊÔÊÔÎļþ - pgsql/src/tutorial/syscat.source¡£ËüÑÝʾÁËÐí¶à´ÓÊý¾Ý¿âϵͳ±íÀï»ñÈ¡ÐÅÏ¢ - ÐèÒªµÄ SELECT¡£ + ¿ÕÖµNULL´æ·ÅÔÚλͼÖУ¬Òò´ËÕ¼ÓúÜÉٵĿռ䡣 - 4.8) ÎҵIJéѯºÜÂý»òÕßûÓÐÀûÓÃË÷Òý¡£ÎªÊ²Ã´£¿ + 4.6)ΪʲôÎҵIJéѯºÜÂý£¿ÎªÊ²Ã´ÕâЩ²éѯûÓÐÀûÓÃË÷Òý£¿ ²¢·Çÿ¸ö²éѯ¶¼»á×Ô¶¯Ê¹ÓÃË÷Òý¡£Ö»ÓÐÔÚ±íµÄ´óС³¬¹ýÒ»¸ö×îСֵ£¬²¢ÇÒ²éѯֻ - Ñ¡Ôñ±íÖнÏС±ÈÀýµÄÐÐʱ²ÉÓÃʹÓÃË÷Òý¡£ÕâÊÇÒòΪË÷ÒýɨÃèÒýÆðµÄËæ¼´´ÅÅÌ´æÈ¡ - ¿ÉÄܱÈÖ±½ÓµØ¶ÁÈ¡±í£¨Ë³ÐòɨÃ裩¸üÂý¡£ÎªÁËÅжÏÊÇ·ñʹÓÃË÷Òý£¬PostgreSQL - ±ØÐë»ñµÃÓйرíµÄͳ¼ÆÖµ¡£ÕâЩͳ¼ÆÖµ¿ÉÒÔʹÓà VACUUM ANALYZE£¬»ò ANALYZE - »ñµÃ¡£Ê¹ÓÃͳ¼ÆÖµ£¬ÓÅ»¯Æ÷ÖªµÀ±íÖÐÓжàÉÙÐУ¬¾ÍÄܹ»¸üºÃµØÅжÏÊÇ·ñÀûÓÃË÷Òý - ¡£Í³¼ÆÖµ¶ÔÈ·¶¨ÓÅ»¯µÄÁ¬½Ó˳ÐòºÍÁ¬½Ó·½·¨Ò²ºÜÓÐÓá£ÔÚ±íµÄÄÚÈÝ·¢Éú±ä»¯Ê±£¬ - Ó¦¶¨ÆÚ½øÐÐͳ¼ÆÖµµÄ»ñÈ¡¡£ + »áÑ¡ÖбíÖнÏС±ÈÀýµÄ¼Ç¼ʱ²Å»á²ÉÓÃË÷Òý¡£ + ÕâÊÇÒòΪË÷ÒýɨÃèÒýÆðµÄËæ¼´´ÅÅÌ´æÈ¡¿ÉÄܱÈÖ±½ÓµØ¶ÁÈ¡±í£¨Ë³ÐòɨÃ裩¸üÂý¡£ + + ΪÁËÅжÏÊÇ·ñʹÓÃË÷Òý£¬PostgreSQL±ØÐë»ñµÃÓйرíµÄͳ¼ÆÖµ¡£ÕâЩͳ¼ÆÖµ¿ÉÒÔ + ʹÓà VACUUM ANALYZE£¬»ò ANALYZE »ñµÃ¡£ + ʹÓÃͳ¼ÆÖµ£¬ÓÅ»¯Æ÷ÖªµÀ±íÖÐÓжàÉÙÐУ¬¾ÍÄܹ»¸üºÃµØÅжÏÊÇ·ñÀûÓÃË÷Òý¡£ + ͳ¼ÆÖµ¶ÔÈ·¶¨ÓÅ»¯µÄÁ¬½Ó˳ÐòºÍÁ¬½Ó·½·¨Ò²ºÜÓÐÓá£ÔÚ±íµÄÄÚÈÝ·¢Éú±ä»¯Ê±£¬Ó¦ + ¶¨ÆÚ½øÐÐͳ¼ÆÖµµÄ¸üÐÂÊÕ¼¯¡£ Ë÷Òýͨ³£²»ÓÃÓÚ ORDER BY »òÖ´ÐÐÁ¬½Ó¡£¶ÔÒ»¸ö´ó±íµÄÒ»´Î˳ÐòɨÃ裬ÔÙ×öÒ»¸öÏÔʽµÄÅÅÐòͨ³£±ÈË÷ÒýɨÃè Òª¿ì¡£ µ«ÊÇ£¬ÔÚ LIMIT ºÍ ORDER BY ½áºÏʹÓÃʱ¾­ - ³£»áʹÓÃË÷Òý£¬ÒòΪֻ»á·µ»Ø±íµÄһС²¿·Ö¡£Êµ¼ÊÉÏ£¬ËäÈ» MAX() ºÍ MIN() + ³£»áʹÓÃË÷Òý£¬ÒòΪÕâÖ»»á·µ»Ø±íµÄһС²¿·Ö¡£ ʵ¼ÊÉÏ£¬ËäÈ» MAX() ºÍ MIN() ²¢²»Ê¹ÓÃË÷Òý£¬Í¨¹ý¶Ô ORDER BY ºÍ LLIMIT ʹÓÃË÷ÒýÈ¡µÃ×î´óÖµºÍ×îСֵҲÊÇ¿ÉÒԵģº - SELECT col - FROM tab - ORDER BY col [ DESC ] - LIMIT 1; + SELECT col + FROM tab + ORDER BY col [ DESC ] + LIMIT 1; + + Èç¹ûÄãÈ·ÐÅPostgreSQLµÄÓÅ»¯Æ÷ʹÓÃ˳ÐòɨÃèÊDz»ÕýÈ·µÄ£¬Äã¿ÉÒÔʹÓÃSET + enable_seqscan TO 'off'Ö¸Á + È»ºóÔÙ´ÎÔËÐвéѯ£¬Äã¾Í¿ÉÒÔ¿´³öʹÓÃÒ»¸öË÷ÒýɨÃèÊÇ·ñȷʵҪ¿ìһЩ¡£ µ±Ê¹ÓÃͨÅä·û²Ù×÷£¬ÀýÈç LIKE »ò ~ ʱ£¬Ë÷ÒýÖ»ÄÜÔÚÌض¨µÄÇé¿öÏÂʹÓ㺠* ×Ö·û´®µÄ¿ªÊ¼²¿·Ö±ØÐëÊÇÆÕͨ×Ö·û´®£¬Ò²¾ÍÊÇ˵£º - * LIKE ģʽ²»ÄÜÒÔ % ´òÍ·¡£ - * ~ £¨ÕýÔò±í´ïʽ£©Ä£Ê½±ØÐëÒÔ ^ ´òÍ·¡£ + + LIKE ģʽ²»ÄÜÒÔ % ´òÍ·¡£ + + ~ £¨ÕýÔò±í´ïʽ£©Ä£Ê½±ØÐëÒÔ ^ ´òÍ·¡£ * ×Ö·û´®²»ÄÜÒÔÆ¥Åä¶à¸ö×Ö·ûµÄģʽÀà´òÍ·£¬ÀýÈç [a-e]¡£ - * ´óСдÎ޹صIJéÕÒ£¬Èç ILIKE ºÍ ~* µÈ²»Ê¹ÓÃË÷Òý¡£µ«¿ÉÒÔÓà 4.12 + * ´óСдÎ޹صIJéÕÒ£¬Èç ILIKE ºÍ ~* µÈ²»Ê¹ÓÃË÷Òý£¬µ«¿ÉÒÔÓà 4.8 ½ÚÃèÊöµÄº¯ÊýË÷Òý¡£ - * ÔÚ×ö initdb ʱ±ØÐë²ÉÓÃȱʡµÄ±¾µØÉèÖà C locale¡£ + * ÔÚ×ö initdb ʱ±ØÐë²ÉÓÃȱʡµÄ±¾µØÉèÖà C + locale£¬ÒòΪϵͳ²»¿ÉÄÜÖªµÀÔÚ·ÇC localeÇé¿öʱÏÂÒ»¸ö×î´ó×Ö·ûÊÇʲô¡£ + ÔÚÕâÖÖÇé¿öÏ£¬Äã¿ÉÒÔ´´½¨Ò»¸öÌØÊâµÄtext_pattern_opsË÷ÒýÀ´ÓÃÓÚLIKEµÄ + Ë÷Òý¡£ - 4.9) ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑù´¦ÀíÎҵIJéѯµÄ£¿ + ÔÚ8.0֮ǰµÄ°æ±¾ÖУ¬³ý·ÇÒª²éѯµÄÊý¾ÝÀàÐͺÍË÷ÒýµÄÊý¾ÝÀàÐÍÏàÆ¥Å䣬·ñÔòË÷Ò + ý¾³£ÊÇδ±»Óõ½£¬ÌرðÊǶÔint2,int8ºÍÊýÖµÐ͵ÄË÷Òý¡£ + + 4.7)ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑùÆÀ¹À´¦ÀíÎҵIJéѯ£¿ ²Î¿¼ EXPLAIN ÊÖ²áÒ³¡£ - 4.10) R-tree Ë÷ÒýÊÇʲô£¿ - - R-tree Ë÷ÒýÓÃÓÚË÷Òý¿Õ¼äÊý¾Ý¡£Ò»¸ö¹þÏ£Ë÷ÒýÎÞ·¨´¦Àí·¶Î§ËÑË÷¡£¶ø B-tree - Ë÷ÒýÖ»ÄÜ´¦ÀíһάµÄ·¶Î§ËÑË÷¡£R-tree - Ë÷Òý¿ÉÒÔ´¦Àí¶àάÊý¾Ý¡£ÀýÈ磬Èç¹û¿ÉÒÔÔÚÒ»¸öÀàÐÍΪ point - µÄ×Ö¶ÎÉϽ¨Á¢Ò»¸ö R-tree Ë÷Òý£¬ÄÇôϵͳÄܸü¸ßЧµØ»Ø´ðÀàËÆ - ¡°Ñ¡ÔñÔÚÒ»¸ö³¤·½Ðη¶Î§ÄÚµÄËùÓе㡱¡£ - ÃèÊö×î³õµÄ R-Tree Éè¼ÆµÄÕýʽÂÛÎÄÊÇ£º - Guttman, A. "R-Trees: A Dynamic Index Structure for Spatial - Searching." Proc of the 1984 ACM SIGMOD Int'l Conf on Mgmt of Data, - 45-57. - Ä㻹¿ÉÒÔÔÚ Stonebraker µÄ¡°Readings in Database - Systems¡±ÀïÕÒµ½ÕâƪÎÄÕ¡£ - ϵͳÄÚÖÃµÄ R-Tree ¿ÉÒÔ´¦Àí¶à±ßÐκͷ½ÐΡ£ÀíÂÛÉÏ˵£¬R-tree - ¿ÉÒÔÀ©Õ¹Îª´¦Àí¸ü¶àάÊý¡£²»¹ýÔÚʵ¼ùÉÏ£¬À©Õ¹ R-trees - ÐèÒªÒ»¶¨µÄ¹¤×÷Á¿£¬¶øÎÒÃÇĿǰûÓÐÈçºÎ×öµÄÎĵµ¡£ - - 4.11) ʲôÊÇ»ùÒò²éѯÓÅ»¯£¨Genetic Query Optimization£©£¿ - - GEQO Ä£¿é²ÉÓûùÒòËã·¨£¨Genetic - Algorithm£¬GA£©¼Ó¿ì¶à±íÁ¬½ÓµÄ²éѯÓÅ»¯¡£ËüÔÊÐíͨ¹ý·ÇÇî¾ÙËÑË÷´¦Àí´óµÄÁ¬½ - Ó²éѯ¡£ - - 4.12) - ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽËÑË÷£¿ÔõÑùÀûÓÃË÷Òý½øÐдóСдΠ- Þ¹ØËÑË÷£¿ + 4.8)ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽ²éÕÒ£¿ÔõÑùÀûÓÃË÷Òý½øÐдóÐ + ¡Ð´Î޹زéÕÒ£¿ ²Ù×÷·û ~ ´¦ÀíÕýÔò±í´ïʽƥÅ䣬¶ø ~* ´¦Àí´óСдÎ޹صÄÕýÔò±í´ïʽƥÅä¡£´óдЩÎÞ¹ØµÄ LIKE ±äÖÖ³ÉΪ ILIKE¡£ + ´óСдÎ޹صĵÈʽ±È½Ïͨ³£Ð´×ö£º - SELECT * - FROM tab - WHERE lower(col) = 'abc'; + SELECT * + FROM tab + WHERE lower(col) = 'abc'; + ÕâÑù½«²»»áʹÓñê×¼µÄË÷Òý¡£µ«ÊÇ¿ÉÒÔ´´½¨Ò»¸ö¿É±»ÀûÓõĺ¯ÊýË÷Òý: - CREATE INDEX tabindex ON tab (lower(col)); - - 4.13) ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ NULL£¿ + CREATE INDEX tabindex ON tab (lower(col)); + + 4.9)ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ NULL + £¿ÎÒÈçºÎ²ÅÄÜ׼ȷÅÅÐò¶ø²»ÂÛij×Ö¶ÎÊÇ·ñº¬ NULL Öµ£¿ - Óà IS NULL ºÍ IS NOT NULL ²âÊÔÕâ¸ö×ֶΡ£ - - 4.14) ¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿ + Óà IS NULL ºÍ IS NOT NULL ²âÊÔÕâ¸ö×ֶΣ¬¾ßÌå·½·¨ÈçÏ£º + SELECT * + FROM tab + WHERE col IS NULL; + + ΪÁËÄܶԺ¬ NULL×Ö¶ÎÅÅÐò£¬¿ÉÔÚ ORDER BY Ìõ¼þÖÐʹÓà IS NULLºÍ IS NOT + NULL ÐÞÊηû£¬Ìõ¼þΪÕæ true ½«±ÈÌõ¼þΪ¼Ùfalse + ÅÅÔÚÇ°Ã棬ÏÂÃæµÄÀý×ӾͻὫº¬ NULL µÄ¼Ç¼ÅÅÔÚ½á¹ûµÄÉÏÃ沿·Ö£º + SELECT * + FROM tab + ORDER BY (col IS NOT NULL) + + 4.10)¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿ - ÀàÐÍ ÄÚ²¿Ãû³Æ ˵Ã÷ - -------------------------------------------------- - "char" char 1¸ö×Ö·û character - CHAR(#) bpchar ¶¨³¤×Ö·û´®£¬Êµ¼ÊÊý¾Ý²»×㶨Ò峤¶Èʱ£¬ÒÔ¿Õ¸ñ²¹Æë - VARCHAR(#) varchar + ÀàÐÍ ÄÚ²¿Ãû³Æ ˵Ã÷ + VARCHAR(n) varchar Ö¸¶¨ÁË×î´ó³¤¶È£¬±ä³¤×Ö·û´®£¬²»×㶨Ò峤¶ÈµÄ²¿·Ö²»²¹Æë - TEXT text ´®³¤¶È½öÊÜÐеÄ×î´ó³¤¶ÈÏÞÖÆ - BYTEA bytea ±ä³¤×Ö½ÚÐòÁУ¨±ä³¤µÄ¶þ½øÖÆÊý¾Ý£© + CHAR(n) bpchar ¶¨³¤×Ö·û´®£¬Êµ¼ÊÊý¾Ý²»×㶨Ò峤¶Èʱ£¬ÒÔ¿Õ¸ñ²¹Æë + TEXT text ûÓÐÌرðµÄÉÏÏÞÏÞÖÆ£¨½öÊÜÐеÄ×î´ó³¤¶ÈÏÞÖÆ£© + BYTEA bytea ±ä³¤×Ö½ÚÐòÁУ¨Ê¹ÓÃNULLÒ²ÊÇÔÊÐíµÄ£© + "char" char Ò»¸ö×Ö·û + ÔÚϵͳ±íºÍÔÚһЩ´íÎóÐÅÏ¢ÀïÄ㽫¿´µ½ÄÚ²¿Ãû³Æ¡£ - ÉÏÃæ×îºóËÄÖÖÀàÐÍÊÇ"varlena"£¨±ä³¤£©ÀàÐÍ£¨Ò²¾ÍÊÇ˵£¬¿ªÍ·µÄËĸö×Ö½ÚÊdz¤¶ - È£¬ºóÃæ²ÅÊÇÊý¾Ý£©¡£ÓÚÊÇʵ¼ÊÕ¼ÓõĿռä±ÈÉùÃ÷µÄ´óСҪ¶àһЩ¡£È»¶øÕâЩÀàÐ - Ͷ¼¿ÉÒÔ±»Ñ¹Ëõ´æ´¢£¬Ò²¿ÉÒÔÓà TOAST + + ÉÏÃæËùÁеÄÇ°ËÄÖÖÀàÐÍÊÇ"varlena"£¨±ä³¤£©ÀàÐÍ£¨Ò²¾ÍÊÇ˵£¬¿ªÍ·µÄËĸö×Ö½ÚÊ + dz¤¶È£¬ºóÃæ²ÅÊÇÊý¾Ý£©¡£ ÓÚÊÇʵ¼ÊÕ¼ÓõĿռä±ÈÉùÃ÷µÄ´óСҪ¶àһЩ¡£ + È»¶øÕâЩÀàÐͶ¼¿ÉÒÔ±»Ñ¹Ëõ´æ´¢£¬Ò²¿ÉÒÔÓà TOAST ÍÑ»ú´æ´¢£¬Òò´Ë´ÅÅÌ¿Õ¼äÒ²¿ÉÄܱÈÔ¤ÏëµÄÒªÉÙ¡£ - CHAR(n) ×îÊʺÏÓÚ´æ´¢³¤¶È»ù±¾²î²»¶àµÄ×Ö·û´®¡£VARCHAR(n) - ÔÚ´æ´¢ÏÞÖÆÁË×î´ó³¤¶ÈµÄ±ä³¤×Ö·û´®ÊÇ×îºÃµÄ¡£TEXT - ÊÊÓÃÓÚ´æ´¢²»ÏÞÖƳ¤¶ÈµÄ×Ö·û´®£¬×î´ó¿É´ï 1G¡£BYTEA + + VARCHAR(n) ÔÚ´æ´¢ÏÞÖÆÁË×î´ó³¤¶ÈµÄ±ä³¤×Ö·û´®ÊÇ×îºÃµÄ¡£ TEXT + ÊÊÓÃÓÚ´æ´¢×î´ó¿É´ï 1G×óÓÒµ«Î´¶¨ÒåÏÞÖƳ¤¶ÈµÄ×Ö·û´®¡£ + + CHAR(n) ×îÊʺÏÓÚ´æ´¢³¤¶ÈÏàͬµÄ×Ö·û´®¡£ + CHAR(n)»á¸ù¾ÝËù¸ø¶¨µÄ×ֶ㤶ÈÒÔ¿Õ¸ñ²¹×㣨²»×ãµÄ×Ö¶ÎÄÚÈÝ£©£¬ ¶ø + VARCHAR(n) Ö»´æ´¢Ëù¸ø¶¨µÄÊý¾ÝÄÚÈÝ¡£ BYTEA ÓÃÓÚ´æ´¢¶þ½øÖÆÊý¾Ý£¬ÓÈÆäÊÇ°üº¬ NULL - ×Ö½Ú£¨¶þ½øÖƵÄ0£©µÄÖµ¡£ÕâЩÀàÐ;ßÓÐÀàÐ͵ÄÐÔÄÜ¡£ + ×Ö½ÚµÄÖµ¡£ÕâЩÀàÐ;ßÓÐÏàËƵÄÐÔÄÜÌØÐÔ¡£ - 4.15.1) ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿ + 4.11.1)ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿ PostgreSQL Ö§³Ö SERIAL - Êý¾ÝÀàÐÍ¡£ËüÔÚ×Ö¶ÎÉÏ×Ô¶¯´´½¨Ò»¸öÐòÁкÍË÷Òý¡£ÀýÈ磬 - CREATE TABLE person ( - id SERIAL, - name TEXT - ); + Êý¾ÝÀàÐÍ¡£ËüÔÚ×Ö¶ÎÉÏ×Ô¶¯´´½¨Ò»¸öÐòÁкÍË÷Òý¡£ÀýÈ磺 + CREATE TABLE person ( + id SERIAL, + name TEXT + ); + »á×Ô¶¯×ª»»Îª£º - CREATE SEQUENCE person_id_seq; - CREATE TABLE person ( - id INT4 NOT NULL DEFAULT nextval('person_id_seq'), - name TEXT - ); - CREATE UNIQUE INDEX person_id_key ON person ( id ); - ²Î¿¼ create_sequence ÊÖ²áÒ³»ñÈ¡¹ØÓÚÐòÁеĸü¶àÐÅÏ¢¡£Ä㻹¿ÉÒÔÓÃÿÐÐµÄ - oid ×Ö¶Î×÷Ϊһ¸öΨһֵ¡£²»¹ý£¬Èç¹ûÄãÐèÒªÇãµ¹ºÍÖØÔØÊý¾Ý¿â£¬ÄãÐèҪʹÓà - pg_dump µÄ -o Ñ¡Ïî»òÕß COPY WITH OIDS Ñ¡ÏîÒÔ±£Áô OID¡£ - - 4.15.2) ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿ + CREATE SEQUENCE person_id_seq; + CREATE TABLE person ( + id INT4 NOT NULL DEFAULT nextval('person_id_seq'), + name TEXT + ); + + ²Î¿¼ create_sequence ÊÖ²áÒ³»ñÈ¡¹ØÓÚÐòÁеĸü¶àÐÅÏ¢¡£ + + 4.11.2)ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿ Ò»ÖÖ·½·¨ÊÇÔÚ²åÈë֮ǰÏÈÓú¯Êý nextval() ´ÓÐòÁжÔÏóÀï¼ìË÷³öÏÂÒ»¸ö SERIAL - Öµ£¬È»ºóÔÙÏÔʽ²åÈ롣ʹÓà 4.15.1 ÀïµÄÀý±í£¬¿ÉÓÃαÂëÕâÑùÃèÊö£º - new_id = execute("SELECT nextval('person_id_seq')"); - execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise - Pascal')"); + Öµ£¬È»ºóÔÙÏÔʽ²åÈ롣ʹÓà 4.11.1 ÀïµÄÀý±í£¬¿ÉÓÃαÂëÕâÑùÃèÊö£º + new_id = execute("SELECT nextval('person_id_seq')"); + execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal')"); + ÕâÑù»¹ÄÜÔÚÆäËû²éѯÖÐʹÓôæ·ÅÔÚ new_id ÀïµÄÐÂÖµ£¨ÀýÈ磬×÷Ϊ person - ±íµÄÍâ¼ü£©¡£×¢Òâ×Ô¶¯´´½¨µÄ SEQUENCE ¶ÔÏóµÄÃû³Æ½«»áÊÇ - __seq£¬ÕâÀï table ºÍ serialcolumn + ±íµÄÍâ¼ü£©¡£ ×¢Òâ×Ô¶¯´´½¨µÄ SEQUENCE ¶ÔÏóµÄÃû³Æ½«»áÊÇ +
__seq£¬ ÕâÀï table ºÍ serialcolumn ·Ö±ðÊÇÄãµÄ±íµÄÃû³ÆºÍÄãµÄ SERIAL ×ֶεÄÃû³Æ¡£ + ÀàËƵģ¬ÔÚ SERIAL ¶ÔÏóȱʡ²åÈëºóÄã¿ÉÒÔÓú¯Êý currval() ¼ìË÷¸Õ¸³ÖµµÄ - SERIAL Öµ£¬ÀýÈ磬 - execute("INSERT INTO person (name) VALUES ('Blaise Pascal')"); - new_id = execute("SELECT currval('person_id_seq')"); - ×îºó£¬Äã¿ÉÒÔʹÓÃ´Ó INSERT Óï¾ä·µ»ØµÄ OID - ²éÕÒȱʡֵ£¬¾¡¹ÜÕâ¿ÉÄÜÊÇ×îȱ·¦ÒÆÖ²ÐԵķ½·¨¡£ÔÚ Perl ÀʹÓôøÓÐ - Edmund Mergl µÄ DBD::Pg Ä£¿éµÄ DBI£¬oid Öµ¿ÉÒÔͨ¹ý $sth->execute() - ºóµÄ $sth->{pg_oid_status} »ñµÃ¡£ - - 4.15.3) ʹÓà currval() ºÍ nextval() »áµ¼ÖÂÒ»¸öÓëÆäËûÓû§Ö®¼äµÄÎÉÂÒÇé¿öÂ𣿠- - ²»»á¡£currval() ·µ»Øºǫ́½ø³Ì¶ø²»ÊÇËùÓÐÓû§¸³ÓèµÄµ±Ç°Öµ¡£ - - 4.15.4) - Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖдæÔÚ¼ä¶ÏÄØ£ - ¿ - - ΪÁËÌá¸ß²¢·¢ÐÔ£¬ÐòÁкÅÔÚÐèÒªµÄʱºò¸³ÓèÕýÔÚÔËÐеÄÊÂÎñ£¬²¢ÇÒÖ»ÔÚÊÂÎñ½áÊø - ֮ǰ²»·âËø¡£Õâ¾Í»áµ¼ÖÂزÕÛÊÂÎñºóµÄÐòÁкųöÏÖ¼ä¸ô¡£ - - 4.16) ʲôÊÇ OID£¿Ê²Ã´ÊÇ TID£¿ - - OID ÊÇ PostgreSQL ÖÐÐеÄΨһ±êʶ¡£PostgreSQL - Àï´´½¨µÄÿһÐж¼»ñµÃÒ»¸öΨһµÄ OID¡£ËùÓÐÔÚ initdb ¹ý³ÌÖд´½¨µÄ OID - ¶¼Ð¡ÓÚ 16384 £¨²Î¼û include/access/transam.h£©¡£ËùÓÐÓû§´´½¨µÄ OID - ¶¼´óÓÚ»òµÈÓÚÕâ¸öÖµ¡£È±Ê¡Ê±£¬ËùÓÐÕâЩ OID - ²»½öÔÚÒ»¸ö±í»òÒ»¸öÊý¾Ý¿âÀïÃæΨһ£¬¶øÇÒÔÚÕû¸ö PostgreSQL - °²×°ÀïÒ²ÊÇΨһµÄ¡£ - PostgreSQL ÔÚËüµÄÄÚ²¿ÏµÍ³±íÀïʹÓà OID ÔÚ±íÖ®¼ä½¨Á¢ÁªÏµ¡£ÕâЩ OID - ¿ÉÒÔÓÃÓÚ±êʶÌض¨µÄÓû§ÐÐÒÔ¼°ÓÃÔÚÁ¬½ÓÀï¡£½¨ÒéʹÓÃ×Ö¶ÎÀàÐÍ OID ´æ´¢ OID - Öµ¡£¿ÉÒÔÔÚ OID ×Ö¶ÎÉÏ´´½¨Ò»¸öË÷ÒýÒÔ¿ìËÙ·ÃÎÊ¡£ - OID ´ÓÒ»¸ö±»ËùÓÐÊý¾Ý¿âʹÓõÄÖÐÐÄÇøÓòÀ︳ֵ¸øËùÓÐÐÂÐС£Èç¹ûÄãÏë°Ñ OID - ¸Ä³É±ðµÄÖµ£¬»òÕßÏë×öÒ»·Ý±íµÄ´øÔʼ OID µÄ¿½±´£¬Äã¿ÉÒÔ×öµ½£º - CREATE TABLE new(old_oid oid, mycol int); - SELECT old_oid, mycol INTO new FROM old; - COPY new TO '/tmp/pgtable'; - DELETE FROM new; - COPY new WITH OIDS FROM '/tmp/pgtable'; - OID - ÓÃ4×Ö½ÚµÄÕûÊý±£´æ£¬ÔÚ³¬¹ý40ÒÚʱ½«Òç³ö¡£Ã»ÓÐÈ˱¨¸æ³öÏÖ¹ýÒç³ö£¬¶øÎÒÃÇ´òË - ãÔÚÓÐÈ˱¨¸æ֮ǰÏû³ýÕâ¸öÏÞÖÆ¡£ - TID ÓÃÓÚ±êʶ´ø×ÅÊý¾Ý¿é£¨µØÖ·£©ºÍ£¨¿éÄÚ£©Æ«ÒƵÄÌض¨µÄÎïÀíÐС£TID - ÔÚÐб»¸ü¸Ä»òÖØÔغó·¢Éú¸Ä±ä¡£Ë÷ÒýÈë¿ÚʹÓÃËüÃÇÖ¸ÏòÎïÀíÐС£ - - 4.17) PostgreSQL ʹÓõÄһЩÊõÓïµÄº¬ÒåÊÇʲô£¿ - - һЩԴ´úÂëºÍһЩ¾ÉÒ»µãµÄÎĵµÊ¹ÓÃһЩÓиü³£ÓÃÓ÷¨µÄÊõÓï¡£ÏÂÃæÊÇÆäÖÐÒ»²¿ - ·Ö£º - table, relation, class - row, record, tuple - column, field, attribute - retrieve, select - replace, update - append, insert - OID, serial value - portal, cursor - range variable, table name, table alias - ÓÐÒ»¸öͨÓÃÊý¾Ý¿âÊõÓïµÄÁÐ±í£ºhttp://hea-www.harvard.edu/MST/simul/softw - are/docs/pkgs/pgsql/glossary/glossary.html ¡£ - - 4.18) ΪʲôÎÒÊÕµ½´íÎó¡°ERROR: Memory exhausted in AllocSetAlloc()¡±£¿ + SERIAL Öµ£¬ÀýÈ磺 + execute("INSERT INTO person (name) VALUES ('Blaise Pascal')"); + new_id = execute("SELECT currval('person_id_seq')"); + + 4.11.3)ʹÓà currval() »áµ¼ÖºÍÆäËûÓû§µÄ³åÍ»Çé¿ö£¨race condition£©Â𣿠- ÕâºÜ¿ÉÄÜÊÇϵͳµÄÐéÄâÄÚ´æÓùâÁË£¬»òÕßÄں˶ÔijЩ×ÊÔ´Óнϵ͵ÄÏÞÖÆÖµ¡£ÔÚÆô - ¶¯ postmaster ֮ǰÊÔÊÔÏÂÃæµÄÃüÁ - ulimit -d 262144 - limit datasize 256m - È¡¾öÓÚÄãÓÃµÄ - shell£¬ÉÏÃæÃüÁîÖ»ÓÐÒ»ÌõÄܳɹ¦£¬µ«ÊÇËü½«°ÑÄãµÄ½ø³ÌÊý¾Ý¶ÎÏÞÖÆÉèµÃ±È½Ï¸ß£ - ¬Òò¶øÒ²ÐíÄÜÈòéѯÍê³É¡£ÕâÌõÃüÁîÓ¦ÓÃÓÚµ±Ç°½ø³Ì£¬ÒÔ¼°ËùÓÐÔÚÕâÌõÃüÁîÔËÐк - ó´´½¨µÄ×Ó½ø³Ì¡£Èç¹ûÄãÊÇÔÚÔËÐÐSQL¿Í»§¶ËʱÒòΪºǫ́·µ»ØÁËÌ«¶àµÄÊý¾Ý¶ø³öÏÖ - ÎÊÌ⣬ÇëÔÚÔËÐпͻ§¶Ë֮ǰִÐÐÉÏÊöÃüÁî¡£ + ²»»á¡£currval() ·µ»ØµÄÊÇÄã±¾´Î»á»°½ø³ÌËù¸³µÄÖµ¶ø²»ÊÇËùÓÐÓû§µÄµ±Ç°Öµ¡£ - 4.19) ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL µÄ°æ±¾£¿ + 4.11.4)Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖдæÔÚ + ¼ä¶ÏÄØ£¿ - ´Ó psql À¼üÈë SELECT version()£» + ΪÁËÌá¸ß²¢·¢ÐÔ£¬ÐòÁкÅÔÚÐèÒªµÄʱºò¸³ÓèÕýÔÚÔËÐеÄÊÂÎñ£¬²¢ÇÒÔÚÊÂÎñ½áÊøÖ® + Ç°²»½øÐÐËø¶¨£¬ Õâ¾Í»áµ¼ÖÂÒì³£ÖÐÖ¹µÄÊÂÎñºó£¬ÐòÁкŻá³öÏÖ¼ä¸ô¡£ - 4.20) ΪʲôÎҵĴó¶ÔÏó²Ù×÷µ¼Ö´íÎó¡°invalid large obj - descriptor¡±£¨·Ç·¨µÄ´ó¶ÔÏóÃèÊö·û£©£¿ + 4.12)ʲôÊÇ OID £¿Ê²Ã´ÊÇ CTID £¿ - ÄãÐèÒªÔÚʹÓÃÈκδó¶ÔÏó¾ä±úµÄÇ°ºó·ÅÉÏ BEGIN WORK ºÍ - COMMIT£¬Ò²¾ÍÊÇ˵£¬°üΧ lo_open ... lo_close¡£ - Ä¿Ç° PostgreSQL - Ç¿ÖÆʵʩÕâÌõ¹æÔò£ºÔÚÊÂÎñÌύʱ¹Ø±Õ´ó¶ÔÏó¾ä±ú£¬ÕâÑù£¬£¨Ã»ÓвÉÓÃÊÂÎñʱ£© - £¬Ê״ζԴó¶ÔÏó¾ä±ú×öÈκÎÊÂÇéµÄÆóͼ¶¼»áµ¼ÖÂÒ»¸ö invalid large obj - descriptor¡£ËùÒÔ£¬Èç¹ûÄãûÓÐʹÓÃÒ»¸öÊÂÎñ£¬ÒÔÇ°Äܹ¤×÷µÄ´úÂ루ÖÁÉÙÊÇ´ó¶à - Êýʱ¼ä£©½«»áÉú³ÉÕâôһ¸ö´íÎóÐÅÏ¢¡£ - Èç¹ûÄãʹÓÿͻ§¶Ë½Ó¿Ú£¬Èç ODBC£¬Äã¿ÉÄÜÐèÒª set auto-commit off¡£ + PostgreSQL + Àï´´½¨µÄÿһÐмǼ¶¼»á»ñµÃÒ»¸öΨһµÄOID£¬³ý·ÇÔÚ´´½¨±íʱʹÓÃWITHOUT + OIDSÑ¡Ïî¡£ OID´´½¨Ê±»á×Ô¶¯Éú³ÉÒ»¸ö4×Ö½ÚµÄÕûÊý£¬ËùÓÐ OID ÔÚÕû¸ö + PostgreSQL ÖоùÊÇΨһµÄ¡£ È»¶ø£¬ËüÔÚ³¬¹ý40ÒÚʱ½«Òç³ö£¬ + OID´Ëºó»á³öÏÖÖظ´¡£PostgreSQL ÔÚËüµÄÄÚ²¿ÏµÍ³±íÀïʹÓà OID + ÔÚ±íÖ®¼ä½¨Á¢ÁªÏµ¡£ + + ÔÚÓû§µÄÊý¾Ý±íÖУ¬×îºÃÊÇʹÓÃSERIAlÀ´´úÌæOID + ÒòΪSERIALÖ»ÊDZ£Ö¤ÔÚµ¥¸ö±íÖÐÊý¾ÝÊÇΨһµÄ£¬ÕâÑùËüÒç³öµÄ¿ÉÄÜÐԾͷdz£Ð¡ÁË + £¬ SERIAL8¿ÉÓÃÀ´±£´æ8×Ö½ÚµÄÐòÁкÅ×ֶΡ£ + + CTID ÓÃÓÚ±êʶ´ø×ÅÊý¾Ý¿é£¨µØÖ·£©ºÍ£¨¿éÄÚ£©Æ«ÒƵÄÌض¨µÄÎïÀíÐС£ CTID + ÔڼǼ±»¸ü¸Ä»òÖØÔغó·¢Éú¸Ä±ä¡£Ë÷ÒýÈë¿ÚʹÓÃËüÃÇÖ¸ÏòÎïÀíÐС£ - 4.21) ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿ + 4.13)ΪʲôÎÒÊÕµ½´íÎóÐÅÏ¢¡°ERROR: Memory exhausted in AllocSetAlloc()¡±£¿ - ʹÓà CURRENT_TIMESTAMP£º - CREATE TABLE test(x int, modtime timestamp DEFAULT CURRENT_TIMESTAMP); + ÕâºÜ¿ÉÄÜÊÇϵͳµÄÐéÄâÄÚ´æÓùâÁË£¬»òÕßÄں˶ÔijЩ×ÊÔ´Óнϵ͵ÄÏÞÖÆÖµ¡£ÔÚÆô + ¶¯ postmaster ֮ǰÊÔÊÔÏÂÃæµÄÃüÁ + ulimit -d 262144 + limit datasize 256m + + È¡¾öÓÚÄãÓÃµÄ + shell£¬ÉÏÃæÃüÁîÖ»ÓÐÒ»ÌõÄܳɹ¦£¬µ«ÊÇËü½«°ÑÄãµÄ½ø³ÌÊý¾Ý¶ÎÏÞÖÆÉèµÃ±È½Ï¸ß£ + ¬ + Òò¶øÒ²ÐíÄÜÈòéѯÍê³É¡£ÕâÌõÃüÁîÓ¦ÓÃÓÚµ±Ç°½ø³Ì£¬ÒÔ¼°ËùÓÐÔÚÕâÌõÃüÁîÔËÐкó + ´´½¨µÄ×Ó½ø³Ì¡£ + Èç¹ûÄãÊÇÔÚÔËÐÐSQL¿Í»§¶ËʱÒòΪºǫ́·µ»ØÁËÌ«¶àµÄÊý¾Ý¶ø³öÏÖÎÊÌ⣬ÇëÔÚÔËÐп + Í»§¶Ë֮ǰִÐÐÉÏÊöÃüÁî¡£ - 4.22) ΪʲôʹÓà IN µÄ×Ó²éѯÕâôÂý£¿ + 4.14)ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL µÄ°æ±¾£¿ - Ä¿Ç°£¬ÎÒÃÇͨ¹ýΪÍâ²éѯµÄÿһÐÐ˳ÐòɨÃè×Ó²éѯµÄ½á¹ûÀ´Á¬½Ó×Ó²éѯºÍÍâ²éѯ - ¡£Èç¹û×Ó²éѯ·µ»ØÉÙÊý¼¸ÐУ¬¶øÍâ²éѯ·µ»ØºÜ¶àÐУ¬IN - Ö´Ðеúܿ졣ΪÁ˼ӿìÆäËû IN ²éѯµÄÖ´ÐУ¬¿ÉÒÔÓà EXISTS Ìæ»» IN£º - SELECT * - FROM tab - WHERE col IN (SELECT subcol FROM subtab); - ¸ÄΪ£º - SELECT * - FROM tab - WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = col); - ºóÕßÒªÏëÖ´Ðеøü¿ì£¬subcol - Ó¦¸ÃÊÇÒ»¸öË÷ÒýÁС£ÎÒÃÇÏ£ÍûÔÚδÀ´µÄ·¢²¼°æ±¾ÖÐÐÞ²¹Õâ¸öÏÞÖÆ¡£ + ´Ó psql ÀÊäÈë SELECT version();Ö¸Áî¡£ - 4.23) ÎÒÔõÑù½øÐÐ outer join £¨ÍâÁ¬½Ó£©£¿ + 4.15)ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿ + + ʹÓà CURRENT_TIMESTAMP£º + CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); + + 4.16)ÎÒÔõÑù½øÐÐ outer join £¨ÍâÁ¬½Ó£©£¿ PostgreSQL ²ÉÓñê×¼µÄ SQL Óï·¨Ö§³ÖÍâÁ¬½Ó¡£ÕâÀïÊÇÁ½¸öÀý×Ó£º - SELECT * - FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col); - »ò - SELECT * - FROM t1 LEFT OUTER JOIN t2 USING (col); - ÕâÁ½¸öµÈ¼ÛµÄ²éѯÔÚ t1.col ºÍ t2.col ÉÏ×öÁ¬½Ó£¬²¢ÇÒ·µâ»?t1 - ÖÐËùÓÐδÁ¬½ÓµÄÐУ¨ÄÇЩÔÚ t2 ÖÐûÓÐÆ¥ÅäµÄÐУ©¡£ÓÒ[Íâ]Á¬½Ó(RIGHT OUTER - JOIN)½«·µ»Ø t2 ÖÐδÁ¬½ÓµÄÐС£ÍêÈ«ÍâÁ¬½Ó£¨FULL OUTER JOIN£©½«·µ»Ø t1 ºÍ - t2 ÖÐδÁ¬½ÓµÄÐС£¹Ø¼ü×Ö OUTER - ÔÚ×ó[Íâ]Á¬½Ó¡¢ÓÒ[Íâ]Á¬½ÓºÍÍêÈ«[Íâ]Á¬½ÓÖÐÊÇ¿ÉÑ¡µÄ£¬ÆÕͨÁ¬½Ó±»³ÉΪÄÚÁ¬½Ó + SELECT * + FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col); + + »òÊÇ + SELECT * + FROM t1 LEFT OUTER JOIN t2 USING (col); + + ÕâÁ½¸öµÈ¼ÛµÄ²éѯÔÚ t1.col ºÍ t2.col ÉÏ×öÁ¬½Ó£¬²¢ÇÒ·µ»Ø t1 + ÖÐËùÓÐδÁ¬½ÓµÄÐУ¨ÄÇЩÔÚ t2 ÖÐûÓÐÆ¥ÅäµÄÐУ©¡£ ÓÒ[Íâ]Á¬½Ó(RIGHT OUTER + JOIN)½«·µ»Ø t2 ÖÐδÁ¬½ÓµÄÐС£ ÍêÈ«ÍâÁ¬½Ó£¨FULL OUTER JOIN£©½«·µ»Ø t1 + ºÍ t2 ÖÐδÁ¬½ÓµÄÐС£ ¹Ø¼ü×Ö OUTER + ÔÚ×ó[Íâ]Á¬½Ó¡¢ÓÒ[Íâ]Á¬½ÓºÍÍêÈ«[Íâ]Á¬½ÓÖÐÊÇ¿ÉÑ¡µÄ£¬ÆÕͨÁ¬½Ó±»³ÆΪÄÚÁ¬½Ó £¨INNER JOIN£©¡£ - ÔÚ´ËÇ°µÄ°æ±¾ÖУ¬ÍâÁ¬½Ó¿ÉÒÔÓà UNION ºÍ NOT IN - À´Ä£Äâ¡£ÀýÈ磬ÏÂÃæµÄÀý×ÓÔÚ±í tab1 ºÍ tab2 Ö®¼ä×öÍâÁ¬½Ó£º - SELECT tab1.col1, tab2.col2 - FROM tab1, tab2 - WHERE tab1.col1 = tab2.col1 - UNION ALL - SELECT tab1.col1, NULL - FROM tab1 - WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2) - ORDER BY col1 - - 4.24) ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿ - - ûÓа취²éѯµ±Ç°Êý¾Ý¿âÖ®ÍâµÄÊý¾Ý¿â¡£ÒòΪ PostgreSQL - ¼ÓÔØÊý¾Ý¿âÏà¹ØµÄϵͳĿ¼£¨ÏµÍ³±í£©£¬¿çÊý¾Ý¿âµÄ²éѯÈçºÎÖ´ÐÐҲδÃ÷È·¡£ - contrib/dblink - ÔÊÐí²ÉÓú¯Êýµ÷ÓÃʵÏÖ¿ç¿â²éѯ¡£µ±È»¿ÉÒÔͬʱÁ¬½Óµ½²»Í¬µÄÊý¾Ý¿â²¢ÔÚ¿Í»§¶Ë - ºÏ²¢½á¹û¡£ - - 4.25) ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿ - - ¿ÉÒÔÔÚ PL/pgSQL º¯ÊýÖÐʹÓà refcursors ·µ»Ø½á¹û¼¯¡£²Î¿´ - http://www.PostgreSQL.org/idocs/index.php?plpgsql-cursors.html, - 23.7.3.3½Ú¡£ - - 4.26) ΪʲôÔÚ PL/PgSQL º¯ÊýÖв»ÄÜ¿É¿¿µØ´´½¨»òɾ³ýÁÙʱ±í£¿ - - PL/PgSQL »º´æº¯ÊýµÄÄÚÈÝ£¬ÓÉ´Ë´øÀ´µÄÒ»¸ö²»ºÃµÄ¸±×÷ÓÃÊÇÈôÒ»¸ö PL/PgSQL - º¯Êý·ÃÎÊÁËÒ»¸öÁÙʱ±í£¬È»ºó¸Ã±í±»É¾³ý²¢Öؽ¨ÁË£¬ÔòÔٴε÷Óøú¯Êý½«Ê§°Ü£¬ - ÒòΪ»º´æµÄº¯ÊýÄÚÈÝÈÔȻָÏò¾ÉµÄÁÙʱ±í¡£½â¾öµÄ·½·¨ÊÇÔÚ PL/PgSQL ÖÐÓà - EXECUTE ¶ÔÁÙʱ±í½øÐзÃÎÊ¡£ÕâÑù»á±£Ö¤²éѯÔÚÖ´ÐÐÇ°×ÜÊÇÖØзÖÎö¡£ - 4.27) ÓÐÄÄЩÊý¾Ý¸´ÖÆÑ¡Ï + 4.17)ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿ - Óм¸ÖÖÖ÷/´Ó·½Ê½µÄ¸´ÖÆÑ¡Ïî¡£ÕâЩѡÏîÖ»ÔÊÐíÖ÷Êý¾Ý¿â½øÐиüУ¬´ÓÊý¾Ý¿âÖ»Ä - ܽøÐжÁ¡£ÍøÒ³ http://gborg.PostgreSQL.org/genpage?replication_research - µÄ×îºóÁгöÁËÕâЩѡÏî¡£ÔÚ - http://gborg.PostgreSQL.org/project/pgreplication/projdisplay.php - ÕýÔÚ½øÐÐÒ»¸ö¶àÖ÷±¾¸´ÖƵĽâ¾ö·½°¸¡£ + ûÓа취²éѯµ±Ç°Êý¾Ý¿âÖ®ÍâµÄÊý¾Ý¿â¡£ ÒòΪ PostgreSQL + Òª¼ÓÔØÓëÊý¾Ý¿âÏà¹ØµÄϵͳĿ¼£¨ÏµÍ³±í£©£¬Òò´Ë¿çÊý¾Ý¿âµÄ²éѯÈçºÎÖ´ÐÐÊDz» + ¶¨µÄ¡£ - 4.28) ÓÐÄÄЩÊý¾Ý¼ÓÃÜÑ¡Ï - - contrib/pgcrypto °üº¬Á˺ܶàÔÚ SQL - ²éѯÖÐʹÓõļÓÃܺ¯Êý¡£¼ÓÃÜ¿Í»§¶Ëµ½·þÎñÆ÷¶Ë´«ÊäÊý¾ÝµÄΨһ·½·¨ÊÇÔÚ - pg_hba.conf ÖвÉÓà hostss ¡£ - 7.3 °æ±¾ÖÐ×Ô¶¯¶ÔÊý¾Ý¿âÓû§ÃÜÂë½øÐмÓÃÜ¡£ÔÚÒÔÇ°µÄ°æ±¾ÖУ¬±ØÐëÔÚ - postgresql.conf Öдò¿ª PASSWORD_ENCRYPTION - Ñ¡Ïî¡£·þÎñÆ÷¿ÉÒÔÔËÐÐÔÚ¼ÓÃܵÄÎļþϵͳÉÏ£¨ÒÔ´ïµ½¼ÓÃܵÄÄ¿µÄ£©¡£ - ---------------------------------------------------------------------- - ---------- + ¸½¼ÓÔöֵģ¿écontrib/dblinkÔÊÐí²ÉÓú¯Êýµ÷ÓÃʵÏÖ¿ç¿â²éѯ¡£µ±È»Óû§Ò²¿ÉÒÔ + ͬʱÁ¬½Óµ½²»Í¬µÄÊý¾Ý¿âÖ´ÐвéѯȻºóÔÚ¿Í»§¶ËºÏ²¢½á¹û¡£ - À©Õ¹ PostgreSQL - - 5.1) ÎÒдÁËÒ»¸öÓû§¶¨Ò庯Êý¡£µ±ÎÒÔÚ psql ÀïÔËÐÐʱ£¬ÎªÊ²Ã´»áµ¼Ö core dump£¿ + 4.18)ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿ - ²úÉúÕâ¸öÎÊÌâµÄÔÒòºÜ¶à¡£ÇëÏÈÔÚÒ»¸öµ¥¶ÀµÄ²âÊÔ³ÌÐòÖвâÊÔÄãµÄ×Ô¶¨Ò庯Êý¡£ + ÔÚº¯ÊýÖзµ»ØÊý¾Ý¼Ç¼¼¯µÄ¹¦ÄÜÊǺÜÈÝÒ×ʹÓõģ¬ÏêÇé²Î¼û£º + http://techdocs.postgresql.org/guides/SetReturningFunctions - 5.2) ÎÒÈçºÎÄܸø PostgreSQL ¹±Ï×һЩͦ²»´íµÄÐÂÀàÐͺͺ¯Êý£¿ + 4.19)ΪʲôÎÒÔÚʹÓÃPL/PgSQLº¯Êý´æÈ¡ÁÙʱ±íʱ»áÊÕµ½´íÎóÐÅÏ¢¡°relation with + OID ##### does not exist¡±£¿ - ½«ÄãµÄÀ©Õ¹·¢Ë͵½ pgsql-hackers ÓʼþÁÐ±í£¬ËüÃÇ×îÖջᱻ·Åµ½ contrib/ - ×ÓĿ¼¡£ + PL/PgSQL»á»º´æº¯ÊýµÄÄÚÈÝ£¬ÓÉ´Ë´øÀ´µÄÒ»¸ö²»ºÃµÄ¸±×÷ÓÃÊÇÈôÒ»¸ö PL/PgSQL + º¯Êý·ÃÎÊÁËÒ»¸öÁÙʱ±í£¬È»ºó¸Ã±í±»É¾³ý²¢Öؽ¨ÁË£¬ÔòÔٴε÷Óøú¯Êý½«Ê§°Ü£¬ + ÒòΪ»º´æµÄº¯ÊýÄÚÈÝÈÔȻָÏò¾ÉµÄÁÙʱ±í¡£½â¾öµÄ·½·¨ÊÇÔÚ PL/PgSQL + ÖÐÓÃEXECUTE ¶ÔÁÙʱ±í½øÐзÃÎÊ¡£ÕâÑù»á±£Ö¤²éѯÔÚÖ´ÐÐÇ°×ܻᱻÖØнâÎö¡£ - 5.3) ÎÒÔõÑùдһ¸ö·µ»ØÒ»ÌõÔª×éµÄ C º¯Êý£¿ + 4.27)Ä¿Ç°ÓÐÄÄЩÊý¾Ý¸´ÖÆ·½°¸¿ÉÓã¿ - ÔÚ PostgreSQL 7.3 ÒÔºóµÄ°æ±¾ÖУ¬C, PL/PgSQL ºÍ SQL - ÍêÈ«Ö§³Ö·µ»ØֵΪ±íµÄº¯Êý¡£¸ü¶àÐÅÏ¢Çë²Î¿¼ ³ÌÐòÔ±Ö¸ÄÏ£¨the Programmer's - Guide£©¡£ÔÚ contrib/tablefunc ÖÐÓÐÒ»¸öÀý×ÓÊÇÓà C - дµÄ·µ»ØֵΪ±íµÄº¯Êý¡£ + ¡°¸´ÖÆ¡±Ö»ÊÇÒ»¸öÊõÓÓкü¸ÖÖ¸´ÖƼ¼Êõ¿ÉʹÓã¬Ã¿ÖÖ¶¼ÓÐÓŵãºÍȱµã£º - 5.4) ÎÒÐÞ¸ÄÁËÒ»¸öÔ´Îļþ£¬ÎªÊ²Ã´ÖØбàÒëºóûÓп´µ½¸Ä±ä£¿ - - Makefiles ÖÐûÓаüº¬Í·ÎļþµÄÕýÈ·ÒÀÀµ¡£Äú±ØÐëÏÈ×ömake clean£¬ ÔÙ×öÒ»´Î - make ¡£Èç¹ûÄúʹÓõÄÊÇ GCC £¬Ôò¿ÉÒÔ²ÉÓÃÑ¡Ïî --enable-depend - ÈñàÒëÆ÷×Ô¶¯Éú³ÉÍ·ÎļþµÄÒÀÀµ¹Øϵ¡£ + Ö÷/´Ó¸´ÖÆ·½Ê½ÊÇÔÊÐíÒ»¸öÖ÷·þÎñÆ÷½ÓÊܶÁ/дµÄÉêÇ룬¶ø¶à¸ö´Ó·þÎñÆ÷Ö»ÄܽÓÊÜ + ¶Á/SELECT²éѯµÄÉêÇ룬 Ä¿Ç°×îÁ÷ÐÐÇÒÊÇÃâ·ÑµÄÖ÷/´Ó PostgreSQL¸´ÖÆ·½°¸ÊÇ + Slony-I ¡£ + + ¶à¸öÖ÷·þÎñÆ÷µÄ¸´ÖÆ·½Ê½ÔÊÐí½«¶Á/дµÄÉêÇë·¢Ë͸ø¶ą̀µÄ¼ÆËã»ú£¬ÕâÖÖ·½Ê½ÓÉÓ + ÚÐèÒªÔÚ¶ą̀·þÎñÆ÷Ö®¼äͬ²½Êý¾Ý±ä¶¯ + ¿ÉÄÜ»á´øÀ´½ÏÑÏÖصÄÐÔÄÜËðʧ£¬PgclusterÊÇÄ¿Ç°ÕâÖÖ·½°¸ + ÖÐ×îºÃµÄ£¬¶øÇÒ»¹¿ÉÒÔÃâ·ÑÏÂÔØ¡£ + + Ò²ÓÐһЩÉÌÒµÐ踶·ÑºÍ»ùÓÚÓ²¼þµÄÊý¾Ý¸´ÖÆ·½°¸£¬Ö§³ÖÉÏÊö¸÷ÖÖ¸´ÖÆÄ£ÐÍ¡£ diff --git a/doc/src/FAQ/FAQ_chinese.html b/doc/src/FAQ/FAQ_chinese.html index 744496dd62..8a4662c253 100644 --- a/doc/src/FAQ/FAQ_chinese.html +++ b/doc/src/FAQ/FAQ_chinese.html @@ -1,990 +1,875 @@ - - - - - - - -PostgreSQL FAQ-ch - - - - -

PostgreSQL ³£¼ûÎÊÌ⣨FAQ£©

-×î½ü¸üУº2003 Äê 01 Ô 06 ÈÕ ÐÇÆÚÒ» 22:27:35 CST -

Ŀǰά»¤ÈËÔ±£ºBruce Momjian (pgman@candle.pha.pa.us)
-ÖÐÎÄ°æά»¤ÈËÔ±£ººÎΰƽ £¨laser@pgsqldb.com £©

-

±¾ÎĵµµÄ×îа汾¿ÉÒÔÔÚhttp://www.postgresql.org/files/documentation/faqs/FAQ.html -²é¿´¡£

-

²Ù×÷ϵͳƽ̨Ïà¹ØµÄÎÊÌâÔÚhttp://www.postgresql.org/docs/faq/Àï»Ø´ð¡£
-

-
-
-

³£¼ûÎÊÌâ

-
-1.1) PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿
-1.2) PostgreSQL µÄ°æȨÊÇʲô?
-1.3) PostgreSQL ÔËÐÐÔÚʲô Unix ƽ̨ÉÏ£¿
-1.4) ¿ÉÓÃµÄ·Ç Unix ƽ̨ÓÐÄÇЩ£¿
-1.5) ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿
-1.6) ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL µÄÖ§³Ö£¿
-1.7) PostgreSQL ×îеİ汾ÊÇʲô£¿
-1.8) ÓÐÄÄЩ¿ÉÓÃµÄ PostgreSQL µÄÎĵµ£¿
-1.9) ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG »òȱʧµÄÌØÐÔ£¿
-1.10) ÎÒÓ¦¸ÃÔõÑùѧϰ SQL £¿
-1.11) PostgreSQL ÊÇ Y2K ¼æÈݵÄÂð£¿
-1.12) ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿
-1.13) ÎÒÓ¦¸ÃÔõÑùÌá½»Ò»¸ö BUG ±¨¸æ£¿
-1.14) PostgreSQL ºÍÆäËû DBMS ±ÈÆðÀ´ÈçºÎ£¿
-1.15) ÎÒÓ¦¸ÃÔõÑùÔÞÖú PostgreSQL £¿ -
-

Óû§¿Í»§¶ËÎÊÌâ

-
-2.1) ÓÐ PostgreSQL µÄ ODBC Çý¶¯³ÌÐòô£¿
-2.2) ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web -Ò³Ã棿
-2.3) PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂð£¿
-2.4) ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL ´ò½»µÀ£¿ -
-

ϵͳ¹ÜÀíÎÊÌâ

-
-3.1) ÎÒÔõÑùÄÜ°Ñ PostgreSQL ×°ÔÚ /usr/local/pgsql -ÒÔÍâµÄµØ·½£¿
-3.2) µ±ÎÒÔËÐÐ postmaster ʱ£¬³öÏÖ Bad System -Call£¨ÏµÍ³µ÷ÓÃ´í£©»ò Core Dumped ´íÎó¡£ÎªÊ²Ã´£¿
-3.3) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ -IpcMemoryCreate ´íÎó¡£ÎªÊ²Ã´£¿
-3.4) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ -IpcSemaphoreCreate ´íÎó¡£ÎªÊ²Ã´£¿
-3.5) ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿
-3.6) -ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿
-3.7) PostgreSQL -Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿
-3.8) ΪʲôÔÚÊÔͼÁ¬½ÓµÇ¼ʱÊÕµ½¡°Sorry, too many -clients¡± ÏûÏ¢£¿
-3.9) pgsql_tmp Ŀ¼ÀﶼÓÐЩʲô£¿
-3.10) ΪʲôҪÔÚÉý¼¶ PostgreSQL ·¢²¼°æ±¾Ê±×ö -dump ºÍ restore £¿ -
-

²Ù×÷ÎÊÌâ

-
-4.1) -¶þ½øÖÆÓαêºÍÆÕͨÓαêÖ®¼äµÄÇø±ðÊÇʲô£¿
-4.2) ÈçºÎֻѡÔñÒ»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿
-4.3) -ÎÒÈçºÎ»ñÈ¡Ò»¸öÊý¾Ý¿âÖбíµÄÁÐ±í£¬»òÕßÊÇÆäËûÎÒÄÜÔÚ psql -Àï¿´µ½µÄ¶«Î÷£¿
-4.4) ÔõÑù´Ó±íÀïÃæɾ³ýÒ»ÁУ¿
-4.5) -Ò»ÐУ¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿
-4.6) -´æ´¢Ò»¸öµäÐ͵ÄÎı¾ÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿
-4.7) -ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿
-4.8) -ÎҵIJéѯºÜÂý»òÕßûÓÐÀûÓÃË÷Òý¡£ÎªÊ²Ã´£¿
-4.9) -ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑù´¦ÀíÎҵIJéѯµÄ£¿
-4.10) R-tree Ë÷ÒýÊÇʲô£¿
-4.11) ʲôÊÇ»ùÒò²éѯÓÅ»¯£¨Genetic Query -Optimization£©£¿
-4.12) -ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽ²éÕÒ£¿ÔõÑùÀûÓÃË÷Òý½øÐдóСдÎ޹زéÕÒ£¿
- -4.13) ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ -NULL£¿
-4.14) ¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿
-4.15.1) -ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿
-4.15.2) -ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿
-4.15.3) ʹÓà currval() ºÍ nextval() -»áµ¼ÖºÍÆäËûÓû§µÄÎÉÂÒÇé¿ö£¨race condition£©Âð£¿
-4.15.4) -Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖдæÔÚ¼ä¶ÏÄØ£¿
- -4.16) ʲôÊÇ OID£¿Ê²Ã´ÊÇ TID £¿
-4.17) PostgreSQL -ʹÓõÄһЩÊõÓïµÄº¬ÒåÊÇʲô£¿
-4.18) ΪʲôÎÒÊÕµ½´íÎó¡°ERROR: Memory -exhausted in AllocSetAlloc()¡±£¿
-4.19) ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL -µÄ°æ±¾£¿
-4.20) ΪʲôÎҵĴó¶ÔÏó²Ù×÷µ¼Ö´íÎó¡°invalid -large obj descriptor¡±£¨·Ç·¨µÄ´ó¶ÔÏóÃèÊö·û£©£¿
-4.21) -ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿
-4.22) ΪʲôʹÓà IN -µÄ×Ó²éѯÕâôÂý£¿
-4.23) ÈçºÎ½øÐÐ outer join £¨ÍâÁ¬½Ó£©£¿
-4.24) ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿
-4.25) ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿
-4.26) ΪʲôÔÚ PL/PgSQL -º¯ÊýÖв»ÄÜ¿É¿¿µØ´´½¨»òɾ³ýÁÙʱ±í£¿
-4.27) ÓÐÄÄЩÊý¾Ý¸´ÖÆÑ¡Ï
-4.28) ÓÐÄÄЩÊý¾Ý¼ÓÃÜÑ¡Ï -
-

À©Õ¹ PostgreSQL

-
-5.1) ÎÒдÁËÒ»¸öÓû§¶¨Ò庯Êý¡£µ±ÎÒÔÚ psql -ÀïÔËÐÐʱ£¬ÎªÊ²Ã´»áµ¼Ö core dump£¿
-5.2) ÎÒÈçºÎÄܸø PostgreSQL -¹±Ï×һЩͦ²»´íµÄÐÂÀàÐͺͺ¯Êý£¿
-5.3) ÎÒÔõÑùдһ¸ö·µ»ØÒ»Ìõ¼Ç¼µÄ C º¯Êý£¿
-5.4) -ÎÒÐÞ¸ÄÁËÒ»¸öÔ´Îļþ£¬ÎªÊ²Ã´ÖØбàÒëºóûÓп´µ½¸Ä±ä£¿
-
-
-

³£¼ûÎÊÌâ

-
-

1.1) PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿

-PostgreSQL ¶Á×÷ Post-Gres-Q-L ¡£ -

PostgreSQL ÊÇÏÂÒ»´ú DBMS µÄÑо¿Ô­ÐÍ POSTGRES -Êý¾Ý¿â¹ÜÀíϵͳµÄÔöÇ¿°æ¡£PostgreSQL ÔÚ±£³Ö POSTGRES -µÄÇ¿´óµÄÊý¾ÝÄ£ÐͺͷḻµÄÊý¾ÝÀàÐ͵Ļù´¡ÉÏ£¬ÓÃÒ»¸öÀ©Õ¹Á赀 SQL -×Ó¼¯È¡´úÁËÔ­Ï鵀 PostQuel ²éѯÓïÑÔ¡£PostgreSQL -ÊÇ×ÔÓɵIJ¢ÇÒËùÓÐÔ´´úÂ붼¿ÉÒÔ»ñµÃ¡£

-

PostgreSQL µÄ¿ª·¢ÓÉ²Î¼Ó PostgreSQL -¿ª·¢ÓʼþÁбíµÄÒ»¸ö¿ª·¢ÈËԱС×é½øÐС£Ä¿Ç°µÄЭµ÷ÈËÊÇ Marc G. Fournier -£¨scrappy@postgreSQL.org -£©¡££¨¹ØÓÚÈçºÎ¼ÓÈë²Î¼û1.6½Ú£©¡£Õâ¸ö¶ÓÎéÏÖÔÚ¸ºÔð PostgreSQL -µÄËùÓпª·¢¡£

-

PostgreSQL 1.01 µÄ×÷ÕßÊÇ Andrew Yu ºÍ Jolly -Chen¡£»¹ÓÐÐí¶àÆäËûÈËΪÒÆÖ²£¬²âÊÔ£¬µ÷ÊÔºÍÔöÇ¿´úÂë×öÁË´óÁ¿¹±Ïס£PostgreSQL -µÄ×î³õÆðÔ´ Postgres£¬ÊÇÔÚ¼ÓÖÝ´óѧ²®¿ËÀû·ÖУµÄ Michael Stonebraker -½ÌÊÚµÄÖ¸µ¼Ï£¬ÓÉÐí¶àÑо¿Éú£¬±¾¿ÆÉúºÍ±à³ÌÖ°Ô±Íê³ÉµÄ¡£

-

Õâ¸öÈí¼þ×î³õÔÚ²®¿ËÀûµÄÃû×ÖÊÇ Postgres¡£ÔÚ 1995 Ä꣬µ±Ôö¼ÓÁË SQL -¹¦Äܺó£¬ËüµÄÃû×Ö¸Ä³É Postgres95¡£ÔÚ 1996ÄêÄ©£¬²Å¸ÄÃûΪ -PostgreSQL¡£

-

1.2) PostgreSQL µÄ°æȨÊÇʲô?

-PostgreSQL ÊÜÏÂÃæµÄ°æȨԼÊø¡£ -

PostgreSQL Êý¾Ý¿â¹ÜÀíϵͳ

-

£¨PostgreSQL Data Base Management System£©

-

²¿·Ö°æȨ£¨c£©1996-2002£¬PostgreSQL È«Çò¿ª·¢Ð¡×é
-²¿·Ö°æȨ£¨c£©1994-6 ¼ÓÖÝ´óѧ¶­ÊÂ

-

£¨Portions copyright (c) 1996-2002, PostgreSQL Global -Development Group
- Portions Copyright (c) 1994-6 Regents of the University of -California£©

-

-ÔÊÐíΪÈκÎÄ¿µÄʹÓ㬿½±´£¬Ð޸ĺͷַ¢Õâ¸öÈí¼þºÍËüµÄÎĵµ¶ø²»ÊÕÈ¡ÈκηÑÓ㬲¢ÇÒÎÞÐëÇ©ÊðÒò´Ë¶ø²úÉúµÄÖ¤Ã÷£¬Ç°ÌáÊÇÉÏÃæµÄ°æȨÉùÃ÷ºÍ±¾¶ÎÒÔ¼°ÏÂÃæÁ½¶ÎÎÄ×Ö³öÏÖÔÚËùÓп½±´ÖС£

-

£¨Permission to use, copy, modify, and distribute this software -and its documentation for any purpose, without fee, and without a -written agreement is hereby granted, provided that the above -copyright notice and this paragraph and the following two -paragraphs appear in all copies.£©

-

-ÔÚÈκÎÇé¿öÏ£¬¼ÓÖÝ´óѧ¶¼²»³Ðµ£ÒòʹÓôËÈí¼þ¼°ÆäÎĵµ¶øµ¼ÖµĶÔÈκε±ÊÂÈ˵ÄÖ±½ÓµÄ£¬¼ä½ÓµÄ£¬ÌØÊâµÄ£¬¸½¼ÓµÄ»òÕßÏà°é¶øÉúµÄË𻵣¬°üÀ¨ÀûÒæËðʧµÄÔðÈΣ¬¼´Ê¹¼ÓÖÝ´óѧÒѾ­½¨ÒéÁËÕâЩËðʧµÄ¿ÉÄÜÐÔʱҲÊÇÈç´Ë¡£

-

£¨IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO -ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR -CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE -USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY -OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE.£©

-

-¼ÓÖÝ´óѧÃ÷È··ÅÆúÈκα£Ö¤£¬°üÀ¨µ«²»¾ÖÏÞÓÚijһÌض¨ÓÃ;µÄÉÌÒµºÍÀûÒæµÄÒþº¬±£Ö¤¡£ÕâÀïÌṩµÄÕâ·ÝÈí¼þÊÇ»ùÓÚ¡°µ±×÷ÊÇ¡±µÄ»ù´¡µÄ£¬Òò¶ø¼ÓÖÝ´óѧûÓÐÔðÈÎÌṩά»¤£¬Ö§³Ö£¬¸üУ¬ÔöÇ¿»òÕßÐ޸ĵķþÎñ¡£

-

£¨THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE -UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, -SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.£©
-
-ÉÏÃæ¾ÍÊÇ BSD -°æȨÉùÃ÷£¬Ò»¸ö¾­µäµÄ¿ªÔ´°æȨÉùÃ÷¡£Ëü¶ÔÔ´´úÂëµÄʹÓÃδ×÷ÈκÎÏÞÖÆ¡£ÎÒÃÇϲ»¶Ëü²¢ÇÒ²»´òËã¸Ä±äËü¡£

-

1.3) PostgreSQL ÔËÐÐÔÚʲô Unix ƽ̨ÉÏ£¿

-

Ò»°ã˵À´£¬Ò»¸öÏÖ´úµÄ UNIX ¼æÈݵÄƽ̨¶¼ÄÜÔËÐÐ PostgreSQL -¡£ÔÚ°²×°Ö¸ÄÏÀïÁгöÁË·¢²¼Ê±¾­¹ýÃ÷È·²âÊÔµÄƽ̨¡£

-

1.4) ¿ÉÓÃµÄ·Ç Unix ƽ̨ÓÐÄÄЩ£¿

-¿Í»§¶Ë -

°Ñ libpq C ¿â£¬psql£¬ÆäËû½Ó¿ÚºÍ¿Í»§¶ËÓ¦ÓóÌÐò±àÒë³É¿ÉÒÔÔÚ MS -Windows ƽ̨ÉÏÔËÐÐÊÇ¿ÉÄܵġ£ÕâÖÖÇé¿öÏ£¬¿Í»§¶ËÔÚ MS Windows -ÉÏÔËÐУ¬²¢ÇÒͨ¹ý TCP/IP ÓëÒ»¸öÔËÐÐÔÚÎÒÃÇÖ§³ÖµÄ Unix -ƽ̨ÉϵķþÎñÆ÷½øÐÐͨѶ¡£·¢²¼°æ±¾Öаüº¬Ò»¸öÎļþ win32.mak ÓÃÓÚÉú³É -Win32 libpq ¿âºÍ psql ¡£PostgreSQL Ò²¿ÉÒÔºÍ ODBC ¿Í»§¶ËͨѶ¡£

-

·þÎñÆ÷

-

Êý¾Ý¿â·þÎñÆ÷ÏÖÔÚ¿ÉÒÔͨ¹ý Cygwin £¬Cygnus µÄ Unix/NT ÒÆÖ²¿âÔÚ -Windows NT ºÍ Win2k ÉÏÔËÐС£²ÎÔÄ·¢²¼°æ±¾ÀïµÄ See -pgsql/doc/FAQ_MSWIN Îļþ»ò http://www.PostgreSQL.org/docs/faq-mswin.html -¡£

-

ÒÆÖ²µ½ MS Win NT/2000/XP µÄ±¾»ú°æµÄ¹¤×÷ÕýÔÚ½øÐС£

-

1.5) ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿

-

PostgreSQL µÄÖ÷ÄäÃûFTPÕ¾µãÊÇ ftp://ftp.PostgreSQL.org/pub£¬¾µÏñÕ¾µã¿ÉÒԲο¼ÎÒÃÇÍøÕ¾µÄÖ÷Ò³¡£

-

1.6) ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL -µÄÖ§³Ö£¿

-

Ö÷ÒªµÄÓʼþÁбíÊÇ£ºpgsql-general@postgreSQL.org¡£¿ÉÒÔÔÚÄÇÀïÌÖÂÛÓÐ¹Ø -PostgreSQL µÄÎÊÌâ¡£Òª¼ÓÈëÁÐ±í£¬·¢Ò»·âÓʼþÄÚÈÝ£¨²»ÊÇÖ÷ÌâÐУ©Îª

-
-        subscribe
-        end
-
-µÄÓʼþµ½ pgsql-general-request@postgreSQL.org -¡£ -

»¹¿ÉÒÔ»ñÈ¡ÕªÒªÁÐ±í¡£Òª¼ÓÈëÕâ¸öÁÐ±í£¬·¢Óʼþµ½£ºpgsql-general-digest-request@postgreSQL.org£¬ÆäÄÚÈÝΪ£º

-
-        subscribe
-        end
-
-ÿµ±Ö÷Áбí´ïµ½´óÔ¼ 30k µÄÏûÏ¢ÄÚÈÝʱ£¬ÕªÒª¾Í·¢Ë͸øÕâ¸öÁбíµÄ³ÉÔ±¡£ -

»¹¿ÉÒԲμӳô³æÓʼþÁÐ±í¡£Òª¼ÓÈëÕâ¸öÁÐ±í£¬·¢ËÍÒ»¸öÓʼþµ½ bugs-request@postgreSQL.org£¬ÄÚÈÝΪ£º

-
-        subscribe
-        end
-
-»¹¿ÉÒԲμӿª·¢ÈËÔ±ÓʼþÁÐ±í¡£Òª¼ÓÈëÕâ¸öÁÐ±í£¬·¢ËÍÒ»¸öÓʼþµ½ hackers-request@postgreSQL.org£¬ÄÚÈÝΪ£º -
-        subscribe
-        end
-
-ÆäËûµÄ¹ØÓÚ PostgreSQL ÓʼþÁбíºÍÆäËûÐÅÏ¢¿ÉÒÔÔÚ PostgreSQL µÄ WWW -Ö÷Ò³ÕÒµ½£º -
http://postgresql.org/
-ÔÚ EFNet ÀﻹÓÐÒ»¸ö IRC ƵµÀ£¬ÆµµÀ #PostgreSQL¡£ÎÒÓà unix -ÃüÁîirc -c '#PostgreSQL' "$USER" irc.phoenix.net -

ÉÌÒµÖ§³Ö¹«Ë¾µÄÁбíÔÚ http://www.PostgreSQL.org/users-lounge/commercial-support.html -¡£

-

1.7) PostgreSQL ×îеİ汾ÊÇʲô£¿

-PostgreSQL ×îеİ汾ÊÇ°æ±¾ 7.2.3¡££¨Òë×¢£ºÏÖÔÚÓ¦¸ÃÊÇ 7.3.1 ÁË¡££© -

ÎÒÃǼƻ®Ã¿ËĸöÔ·¢²¼Ò»¸öÖ÷Òª°æ±¾¡£

-

1.8) ÓÐÄÄЩ¿ÉÓÃµÄ PostgreSQL µÄÎĵµ£¿

-ÔÚ·¢²¼°üÀïÓÐһЩÊֲᣬÊÖ²áÒ³ºÍһЩСµÄ²âÊÔÀý×Ó¡£²Î¼û /doc -Ŀ¼¡££¨Òë×¢£ºÓ¦Îª $PGHOME/doc£©¡£Ä㻹¿ÉÒÔÔÚÏßä¯ÀÀ PostgreSQL -µÄÊֲᣬÔÚ http://www.PostgreSQL.org/users-lounge/docs/ -¡£ -

ÓÐÁ½±¾¹ØÓÚ PostgreSQL µÄÊéÔÚÏßÌṩ£¬ÔÚ http://www.PostgreSQL.org/docs/awbook.html -ºÍ http://www.commandprompt.com/ppbook/ -¡£ÔÚ http://www.ca.PostgreSQL.org/books/ -ÉÏÓйØÓÚ PostgreSQL µÄ¿É¹ºÊé¼®µÄÁÐ±í¡£ÔÚ http://techdocs.PostgreSQL.org/ -ÉÏÊÕ¼¯ÁËÓÐ¹Ø PostgreSQL µÄ¼¼ÊõÎÄÕ¡£

-

psql ÓÐһЩ²»´íµÄ \d -ÃüÁÏÔʾ¹ØÓÚÀàÐÍ£¬²Ù×÷·û£¬º¯Êý£¬¾Û¼¯µÈµÄÐÅÏ¢¡£

-

ÎÒÃÇµÄ web Õ¾µã°üº¬¸ü¶àµÄÎĵµ£®

-

1.9) ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG ºÍȱʧµÄÌØÐÔ£¿

-PostgreSQL Ö§³ÖÒ»¸öÀ©Õ¹Á赀 SQL-92 µÄ×Ó¼¯¡£²ÎÔÄÎÒÃÇµÄ TODO ÁÐ±í£¬»ñÈ¡Ò»¸öÒÑÖª³ô³æ£¬È±Ê§ÌØÐÔºÍδÀ´¼Æ»®¡£ -

1.10) ÎÒÓ¦¸ÃÔõÑùѧϰ SQL£¿

-ÔÚ http://www.postgresql.org/docs/awbook.html -µÄ¹ØÓÚ PostgreSQL µÄÊé½ÌÊÚ SQL¡££¨Òë×¢£ºÎÒÏÂÔص½±¾µØÁË¡££©ÔÚ -http://www.commandprompt.com/ppbook -ÓÐÁíÍâÒ»±¾¹ØÓÚ PostgreSQL µÄÊé¡£ÔÚhttp://www.intermedia.net/support/sql/sqltut.shtm£¬http://ourworld.compuserve.com/homepages/graeme_birchall/HTM_COOK.HTM - ºÍ http://sqlcourse.com -ÓÐÒ»¸ö²»´íµÄÈëÃŽ̡̳£ -

ÁíÒ»¸öÊÇ "Teach Yourself SQL in 21 Days, Second -Edition"£¨21Ììѧ»áSQL£¬µÚ¶þ°æ£©£¬ÔÚ http://members.tripod.com/er4ebus/sql/index.htm

-

ÎÒÃǵÄÐí¶àÓû§Ï²»¶ The Practical SQL Handbook, Bowman, Judith -S., et al., Addison-Wesley ¡£ ÆäËûµÄÓÐ The Complete -Reference SQL, Groff et al., McGraw-Hill ¡£

-

1.11) PostgreSQL ÊÇ Y2K ¼æÈݵÄÂð£¿

-ÊÇ£¬ÎÒÃǺÜÈÝÒ׿ØÖÆ 2000 AD Ö®ºóºÍ 2000 BC ֮ǰµÄÈÕÆÚ¡£ -

1.12) ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿

-Ê×ÏÈ£¬ÏÂÔØ×îеÄÔ´´úÂë²¢ÔĶÁÎÒÃÇ web Õ¾µã»ò·¢²¼°üÖÐµÄ PostgreSQL -¿ª·¢ÕßÎĵµ¡£Æä´Î£¬¼ÓÈë pgsql-hackers ºÍ pgsql-patches -ÓʼþÁÐ±í¡£µÚÈý£¬Ïò pgsql-patches Ìá½»¸ßÖÊÁ¿µÄ²¹¶¡³ÌÐò¡£ -

ÏÖÔÚ´ó¸ÅÓÐÊ®¼¸¸öÈËÓÐ PostgreSQL CVS ¹éµµ COMMIT -µÄȨÏÞ¡£ËûÃǶ¼ÒѾ­Ìá½»Á˷dz£¶à¸ßÖÊÁ¿µÄ²¹¶¡ÁË£¬ÒÔÖÁÓÚÏÖÓеÄÌá½»È˺ÜÄѸúÉϽÚ×࣬²¢ÇÒÎÒÃÇÏàÐÅËûÃÇÌá½»µÄ²¹¶¡¶¼ÊǸßÖÊÁ¿µÄ¡£

-

1.13) ÎÒÓ¦¸ÃÔõÑùÌá½»Ò»¸öBUG±¨¸æ£¿

-Çë·ÃÎÊ http://www.PostgreSQL.org/bugs/bugs.php -µÄ PostgreSQL BugTool Ò³Ãæ, ÄÇÀï¸ø³öÁËÈçºÎÌá½»Ò»¸öBUG±¨¸æµÄÖ¸ÄÏ¡£ -

ͬÑùÒ²Òª¿´¿´ÎÒÃÇµÄ ftp Õ¾µã ftp://ftp.postgreSQL.org/pub£¬¿´ÓÐûÓиüÐ嵀 -PostgreSQL °æ±¾»ò²¹¶¡¡£

-

1.14) PostgreSQL ºÍÆäËû DBMS -±ÈÆðÀ´ÈçºÎ£¿

-ÆÀ¼ÛÈí¼þÓкü¸ÖÖ·½·¨£ºÌØÐÔ£¬ÐÔÄÜ£¬¿É¿¿ÐÔ£¬Ö§³ÖºÍ¼Û¸ñ¡£ -
-
ÌØÐÔ
-
PostgreSQL ÓµÓдóÐÍÉÌÓà DBMS -Àï´ó¶àÊýÌØÐÔ£¬ÀýÈ磺ÊÂÎñ£¬×Ó²éѯ£¬´¥·¢Æ÷£¬ÊÓͼ£¬Íâ¼ü²Î¿¼ÍêÕûÐԺ͸´ÔÓµÄËøµÈ¡£ÎÒÃÇ»¹ÓÐһЩËüÃÇûÓеÄÌØÐÔ£¬ÈçÓû§¶¨ÒåÀàÐÍ£¬¼Ì³Ð£¬¹æÔòºÍ¶à°æ±¾²¢ÐпØÖÆÒÔ¼õÉÙËøµÄÕùÓõȡ£
- -
-
ÐÔÄÜ
-
PostgreSQL -ºÍÆäËûÉÌÓúͿªÔ´µÄÊý¾Ý¿â¾ßÓÐÀàËƵÄÐÔÄÜ¡£¶ÔijЩ´¦ÀíËü±È½Ï¿ì£¬¶ÔÆäËûһЩ´¦ÀíËü±È½ÏÂý¡£Óë -MySQL »ò¸üÇá±ãµÄÊý¾Ý¿âϵͳ±È½Ï£¬ÎÒÃÇÔÚ insert/update -ʱÂý£¬ÒòΪÎÒÃÇÓÐÊÂÎñ´¦Àí¡£µ±È» MySQL ²»¾ßÓÐÎÒÃÇÔÚÉÏÃæµÄÌØÐÔ -¶ÎÀï¸ø³öµÄÈκÎÌØÐÔ¡£ÎÒÃǵÄÖ÷Òª·½ÏòÊÇ¿É¿¿ÐÔºÍÌØÐÔ£¬¾¡¹ÜÎÒÃÇÔÚÿ´Î·¢²¼Ê±²»¶ÏµØ¸Ä½øÐÔÄÜ¡£ÓÐÒ»¸öºÜÓÐȤµÄÍøÒ³±È½ÏÁË -PostgreSQL ºÍ MySQL http://openacs.org/why-not-mysql.html¡£
-
-
¿É¿¿ÐÔ
-
ÎÒÃÇÖªµÀ DBMS -±ØÐëÊÇ¿É¿¿µÄ£¬·ñÔòËü¾ÍÒ»µãÓö¼Ã»ÓС£ÎÒÃÇŬÁ¦×öµ½·¢²¼¾­¹ýÈÏÕæ²âÊԵģ¬Îȶ¨µÄ³ô³æ×îÉٵĴúÂ롣ÿ¸ö°æ±¾ÖÁÉÙÓÐÒ»¸öÔ嵀 -beta -²âÊÔ£¬²¢ÇÒÎÒÃǵķ¢²¼ÀúÊ·ÏÔʾÎÒÃÇ¿ÉÒÔÌṩÎȶ¨µÄ£¬Àι̵ģ¬¿ÉÓÃÓÚÉú²úʹÓõİ汾¡£ÎÒÃÇÏàÐÅÔÚÕâ·½ÃæÎÒÃÇÓëÆäËûµÄÊý¾Ý¿âÈí¼þÊÇÏ൱µÄ¡£
- -
-
Ö§³Ö
-
-ÎÒÃǵÄÓʼþÁбíÌṩһ¸ö·Ç³£´óµÄ¿ª·¢ÈËÔ±ºÍÓû§µÄ×éÒÔ°ïÖú½â¾öËùÅöµ½µÄÈκÎÎÊÌâ¡£ÎÒÃDz»Äܱ£Ö¤¿Ï¶¨Äܽâ¾öÎÊÌ⣬Ïà±È֮ϣ¬ÉÌÓà -DBMS -Ò²²¢²»ÊÇ×ÜÄܹ»Ìṩ½â¾ö·½·¨¡£Ö±½ÓÓ뿪·¢ÈËÔ±£¬Óû§Èº£¬ÊÖ²áºÍÔ´³ÌÐò½Ó´¥Áî -PostgreSQL µÄÖ§³Ö±ÈÆäËû DBMS -»¹ÒªºÃ¡£»¹ÓÐһЩÉÌÒµÐÔµÄÔ¤°ü×°µÄÖ§³Ö£¬¿ÉÒÔ¸øÌṩ¸øÄÇЩÐèÒªµÄÈË¡££¨²ÎÔÄÖ§³Ö -FAQ Ìõ¿î 1.6 С½Ú¡££©
-
-
¼Û¸ñ
-
-ÎÒÃǶÔÈκÎÓÃ;¶¼Ãâ·Ñ£¬°üÀ¨ÉÌÓúͷÇÉÌÓÃÄ¿µÄ¡£Äã¿ÉÒÔ²»¼ÓÏÞÖƵØÏòÄãµÄ²úÆ·Àï¼ÓÈëÎÒÃǵĴúÂ룬³ýÁËÄÇЩÎÒÃÇÔÚÉÏÃæµÄ°æȨÉùÃ÷ÀïÉùÃ÷µÄ -BSD ·ç¸ñµÄ°æȨÍâ¡£
-
-

1.15) ÎÒÓ¦¸ÃÔõÑùÔÞÖú PostgreSQL £¿

-

×Ô´Ó1996Ä꿪ʼ£¬PostgreSQL -ÒѾ­ÓÐÁËÒ»¸öÓÅÐãµÄ×éÖ¯¡£ÕâЩӦ¸Ã¹é¹¦ÓÚ Marc -Fournier£¬ÊÇËû´´½¨Á˲¢ÔÚÕâЩÄêÒ»Ö±¹ÜÀíÕâ¸ö×éÖ¯¡£

-

-¶ÔÓÚÒ»¸ö¿ªÔ´ÏîÄ¿À´Ëµ£¬ÖÊÁ¿»ù´¡ÉèÊ©ÊǷdz£ÖØÒªµÄ¡£ËüÄÜ·ÀÖ¹³öÏÖÑÏÖØÑÓ³ÙÏîÄ¿Ç°½øµÄ»ìÂÒ¡£

-

-ÏÔÈ»£¬Õâ¸ö×éÖ¯µÄÔËת³É±¾²»·Æ¡£Î¬³ÖÆäÇ°½øÓи÷ÖÖÔ¶ȵġ¢Ò»´ÎÐԵĿªÖ§¡£Èç¹ûÄã»òÕßÄãµÄ¹«Ë¾ÄܽøÐоèÔùÒÔÖ§³ÖÕâÏîÊÂÒµ£¬Çë·ÃÎÊ -http://store.pgsql.com/shopping/ -½øÐоèÔù¡£

-

ËäÈ»¸ÃÍøÒ³Ìá¼°ÁË PostgreSQL ¹«Ë¾£¬ÕâЩ¾èÔù½«½öÓÃÓÚÖ§³Ö -PostgreSQL -ÏîÄ¿£¬²¢²»»áÓÃÓÚ×ÊÖúû¸öÌض¨µÄ¹«Ë¾¡£Èç¹ûÄãÔ¸Ò⣬Ҳ¿ÉÒÔÓʼÄ֧Ʊµ½ÁªÏµµØÖ·¡£

-
-
-

Óû§¿Í»§¶ËÎÊÌâ

-
-

2.1) ÓÐ PostgreSQL µÄ ODBC Çý¶¯Ã´£¿

-ÓÐÁ½¸ö ODBC Çý¶¯¿ÉÒÔ»ñµÃ£¬PsqlODBC ºÍ OpenLink ODBC. -

¿ÉÒÔÔÚhttp://gborg.postgresql.org/project/psqlodbc/projdisplay.php -ÏÂÔØ PsqlODBC ¡£

-

OpenLink ODBC ¿ÉÒÔ´Ó http://www.openlinksw.com/ -»ñµÃ¡£ËüÓëËûÃǵıê×¼ ODBC -¿Í»§¶ËÈí¼þ¼æÈÝ£¬Òò¶øÄã¿ÉÒÔÔÚÈκÎËûÃÇÖ§³ÖµÄ¿Í»§¶Ëƽ̨£¨Win, Mac, -Unix, VMS£©ÉÏʹÓà PostgreSQL ODBC¡£

-

ËûÃÇ¿ÉÄܽ«Õâ¸ö²úÆ·ÏúÊÛ¸øÄÇЩÐèÒªÉÌÒµÖ§³ÖµÄÓû§£¬µ«ÊÇ×ÜÊÇÓÐÒ»¸ö -freeware £¨×ÔÓÉÈí¼þ£©µÄ°æ±¾¿ÉÒԵõ½¡£ÇëѯÎÊ postgres95@openlink.co.uk¡£

-

2.2) ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web -Ò³Ã棿

-Ò»¸ö½éÉÜÒÔÊý¾Ý¿âΪºǫ́µÄͦ²»´íµÄ Õ¾µãÊÇ£ºhttp://www.webreview.com ¡£ -

¶ÔÓÚ Web ¼¯³É£¬PHP ÊÇÒ»¸ö¼«ºÃµÄ½Ó¿Ú¡£ËüÔÚ£ºhttp://www.php.net/ ¡£

-

¶ÔÓÚ¸´ÔÓµÄÈÎÎñ£¬ºÜ¶àÈ˲ÉÓà Perl ½Ó¿ÚºÍ CGI.pm »ò mod_perl ¡£

-

2.3) PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂð£¿

-Êǵġ£Óм¸¸öÊÊÓÃÓÚ PostgreSQL µÄͼÐνӿڡ£°üÀ¨PgAccess£¨http://www.pgaccess.com)£¬PgAdmin II -£¨http://www.pgadmin.org£¬½öÊÊÓÃÓÚWin32£©£¬ -RHDB Admin (http://sources.redhat.com/rhdb/£© -ÒÔ¼° Rekall £¨http://www.thekompany.com/products/rekall/£¬ -רÓеÄ/proprietary)¡£»¹ÓÐPHPPgAdmin £¨http://phppgadmin.sourceforge.net/£© -£¬Ò»¸ö»ùÓÚ web µÄ PostgreSQL ·ÃÎʽӿڡ£ -

ÎÒÃÇÓÐÒ»¸ö²»´íµÄͼÐÎÓû§½çÃ棬³ÆΪ PgAccess -£¬ËüÒ²¿ÉÒÔÓÃ×÷±¨±íÉú³ÉÆ÷¡£ÍøÒ³ÊÇ http://www.pgaccess.org/¡£

-

2.4) ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL -´ò½»µÀ£¿

-

´ó¶àÊýÁ÷Ðеıà³ÌÓïÑÔ¶¼ÓзÃÎÊ PostgreSQL -µÄ½Ó¿Ú¡£Çë¼ì²é±à³ÌÓïÑÔµÄÀ©Õ¹Ä£¿éÁÐ±í¡£

-

PostgreSQL ·¢²¼°üÖаüº¬ÁËÒÔϽӿڣº

- -

ÆäËûµÄ½Ó¿ÚÔÚ http://gborg.postgresql.org É쵀 -Drivers/Interfaces С½Ú¡£

-
-
-

ϵͳ¹ÜÀíÎÊÌâ

-
-

3.1) ÎÒÔõÑùÄÜ°Ñ PostgreSQL ×°ÔÚ -/usr/local/pgsql ÒÔÍâµÄµØ·½£¿

-

ÔÚÔËÐÐ configure ʱ¼ÓÉÏ --prefix Ñ¡Ïî¡£

-

3.2) µ±ÎÒÔËÐÐ postmaster ʱ£¬³öÏÖ Bad -System Call£¨ÏµÍ³µ÷ÓÃ´í£©»ò Core Dumped ´íÎó¡£ÎªÊ²Ã´£¿

-

Õâ¿ÉÄÜÊǺܶ෽ÃæµÄÎÊÌ⣬ÇëÏȼì²é²Ù×÷ϵͳºËÐÄÊÇ·ñÖ§³Ö System V -À©Õ¹¡£PostgreSQL ÐèÒªÄÚºËÖ§³Ö¹²ÏíÄÚ´æºÍÐźŵơ£

-

3.3) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ -IpcMemoryCreate ´íÎó¡£ÎªÊ²Ã´£¿

-ÄãҪôÊÇûÓÐÔÚÄÚºËÀïÕýÈ·ÅäÖù²ÏíÄڴ棬ҪôÊÇÄãÐèÒªÀ©´óÄãµÄÄں˵ĿÉÓù²ÏíÄÚ´æ¡£ÐèÒªµÄ¹²ÏíÄÚ´æ¾ßÌåµÄÊýÁ¿È¡¾öÓÚÄãµÄÌåϵ½á¹¹ºÍÄãÅäÖÃÄãµÄ -postmaster -ÔËÐÐʱʹÓõĻº³åÇøºÍºó¶Ë½ø³ÌÊýÄ¿¡£¶Ô´ó¶àÊýϵͳ£¬Ê¹ÓÃȱʡ»º³åÇøºÍ½ø³ÌÊýĿʱ£¬Äã×îÉÙÐèÒª~1MB¡£Óйع²ÏíÄÚ´æºÍÐźŵƵÄÏêϸÐÅÏ¢Çë²Î¿¼ -PostgreSQL -Administrator's Guide ¡£ -

3.4) µ±ÎÒÊÔͼÔËÐÐ postmaster ʱ£¬³öÏÖ -IpcSemaphoreCreate ´íÎó¡£ÎªÊ²Ã´£¿

-

Èç¹û´íÎóÐÅÏ¢ÊÇ IpcSemaphoreCreate: semget failed (No space -left on -device)£¬ÄÇôԭÒòÊÇÄãµÄÄÚºËûÓÐÅäÖÃ×ã¹»µÄÐźŵÆ×ÊÔ´¡£Postgres -µÄÿ¸öDZÔڵĺǫ́½ø³Ì¶¼ÐèÒªÒ»¸öÐźŵơ£Ò»¸öÁÙʱµÄ½â¾ö·½·¨ÊÇÒԱȽÏÉٵĺǫ́½ø³ÌÊý£¨²ÎÊý£©Æô¶¯ -postmaster¡£Ê¹Óÿª¹Ø -N ´øÒ»¸öÉÙÓÚȱʡֵ 32 µÄ²ÎÊýÔËÐÐ -postmaster¡£¸ü³¤¾ÃµÄ½â¾ö·½·¨ÊǼӴóÄãµÄÄÚºËµÄ SEMMNS ºÍ SEMMNI ²ÎÊý¡£

-

ÔÚÊý¾Ý¿â·ÃÎÊÁ¿ºÜ´óʱ£¬ÐźŵƲ»¿ÉÓÿÉÄܵ¼ÖÂϵͳ±ÀÀ£¡£

-

-Èç¹û´íÎóÐÅÏ¢ÊÇÆäËûµÄʲô¶«Î÷£¬Äã¿ÉÄܾ͸ù±¾Ã»ÓÐÔÚÄÚºËÀïÃæÅäÖÃÐźŵÆÖ§³Ö¡£Óйع²ÏíÄÚ´æºÍÐźŵƵÄÏêϸÐÅÏ¢Çë²Î¿¼ -PostgreSQL -Administrator's Guide ¡£

-

3.5) ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿

-

ȱʡʱ£¬PostgreSQL Ö»ÔÊÐíͨ¹ý unix -ÓòÌ×½Ó×ÖÀ´×Ô±¾»úµÄÁ¬½Ó¡£³ý·ÇÄãʹÓà -i ¿ª¹ØÆô¶¯ -postmaster£¬²¢ÇÒͨ¹ý¶ÔÓ¦µÄ±à¼­ -$PGDATA/pg_hba.conf Îļþ´ò¿ªÁËÖ÷»úΪ»ù´¡£¨ host-based -£©µÄÈÏÖ¤£¬·ñÔòÆäËû»úÆ÷ÊDz»ÄÜÓëÄãµÄ»úÆ÷Á¬½ÓµÄ¡£ÕâÑù½«ÔÊÐí TCP/IP -Á¬½Ó¡£

-

3.6) -ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿

-

µ±È»£¬Ë÷Òý¿ÉÒÔ¼ÓËÙ²éѯ¡£EXPLAIN -ÃüÁîÔÊÐíÄã¹Û²ì PostgreSQL -ÈçºÎ½âÊÍÄãµÄ²éѯ£¬ÒÔ¼°Ê¹ÓÃÁËÄÄЩË÷Òý¡£

-

Èç¹ûÄãÕý´¦ÀíÒ»¶Ñ INSERT£¬¿¼ÂÇʹÓà -COPY -ÃüÁîÒÔ´óÅúÁ¿µÄ·½Ê½½øÐС£ÕâÑù×ö±Èµ¥¶ÀµÄÒ»¸ö¸ö INSERT ¿ìµÃ¶à¡£Æä´Î£¬Ã»Óд¦ÓÚ BEGIN -WORK/COMMIT -ÊÂÎñ¿éÖ®¼äµÄÓï¾ä±»ÈÏΪÊôÓÚͬһ¸öÊÂÎñ¡£ÊÔ×ÅÔÚÒ»¸öÊÂÎñ¿éÀïÃæ´¦Àí¸ü¶àµÄÓï¾ä¡£ÕâÑù¿ÉÒÔ¼õÉÙÊÂÎñ´øÀ´µÄ¶îÍ⿪Ïú¡£Í¬Ñù£¬ÔÚ×ö´óÁ¿µÄÊý¾Ý¸Ä±äʱ¿¼ÂÇɾ³ýºÍÖؽ¨Ë÷Òý¡£

-

»¹Óм¸¸öµ÷½ÚµÄÑ¡Ïî¿ÉÒÔʹÓá£Äã¿ÉÒÔͨ¹ý´ø -o -F Ñ¡ÏîÆô¶¯ -postmaster À´½ûÖ¹ fsync()¡£ÕâÑù½«±ÜÃâÿ´ÎÊÂÎñºóµ÷Óà fsync() -°ÑÊý¾Ýˢе½´ÅÅÌÉÏ¡£

-

Ä㻹¿ÉÒÔʹÓà postmaster -B -Ñ¡ÏîÔö¼Óºó¶Ë½ø³ÌʹÓõĹ²ÏíÄڴ滺³åµÄÊýÄ¿¡£Èç¹ûÄã°ÑÕâ¸ö²ÎÊýÉèÖõÃÌ«´ó£¬postmaster -¿ÉÄÜÎÞ·¨Æô¶¯£¬ÒòΪÄãÒѾ­³¬¹ýÁËÄãµÄÄÚºËÔÚ¹²ÏíÄÚ´æ¿Õ¼äÉϵÄÏÞÖÆ¡£Ã¿¸ö»º³åÇøÊÇ -8K ²¢ÇÒȱʡ 64 ¸ö»º³åÇø¡£

-

Ä㻹¿ÉÒÔʹÓúǫ́½ø³ÌµÄ -S -Ñ¡ÏîÀ´Ôö¼Óÿ¸öºǫ́½ø³ÌÓÃÓÚÁÙʱÅÅÐòÓõÄ×î´óÄÚ´æÊýÁ¿¡£-S -ÖµÊÇÒÔK×ֽڼƵģ¬È±Ê¡ÊÇ 512 £¨Ò²¾ÍÊÇ˵£¬512K£©¡£

-

Ä㻹¿ÉÒÔʹÓà CLUSTER -ÃüÁîÀ´°Ñ±íÀïµÄÊý¾Ý°´ÕÕij¸öË÷Òý½øÐоۼ¯´æ·Å¡£²ÎÔÄ CLUSTER -µÄÊÖ²áÒ³»ñÈ¡¸ü¶àϸ½Ú¡£

-

3.7) PostgreSQL -Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿

-

PostgreSQL -Óм¸¸öÌØÐÔÓÃÓÚ±¨¸æ״̬ÐÅÏ¢£¬ÕâЩÐÅÏ¢¿ÉÄܶԵ÷ÊÔÓÃ;ºÜÓаïÖú¡£

-

Ê×ÏÈ£¬Í¨¹ý¸½´ø --enable-cassert Ñ¡ÏîÔËÐÐ configure£¬Óкܶà -assert() -¼à¿Øºǫ́½ø³ÌºÍÔÚ·¢ÉúijЩδÔøÔ¤ÁϵÄÏÖÏóʱֹͣ³ÌÐòÔËÐС£

-

postmaster ºÍ postgres ¶¼ÓÐһЩ¿ÉÓõÄÑ¡Ïî¡£Ê×ÏÈ£¬µ±ÄãÆô¶¯ -postmaster -ʱ£¬È·±£Äã°Ñ±ê×¼Êä³öºÍ±ê×¼´íÎóÊä³ö¶¨Ïòµ½ÁËÒ»¸öÈÕÖ¾ÎļþÀïÈ¥ÁË£¬Ïó£º

-
-        cd /usr/local/pgsql
-        ./bin/postmaster >server.log 2>&1 &
-
-ÕâÑù½«ÔÚ PostgreSQL ¶¥¼¶Ä¿Â¼ÏÂÊä³öÒ»¸ö server.log -Îļþ¡£Õâ¸öÎļþ°üº¬·þÎñÆ÷Åöµ½µÄÎÊÌâºÍ´íÎóµÄÓÐÓÃÐÅÏ¢¡£postmaster -ÓÐÒ»¸ö -d Ñ¡Ï¸ÃÑ¡ÏîÔÊÐíÎÒÃÇ»ñµÃ¸ü¶àµÄϸ½Ú»ã±¨¡£-d -Ñ¡Ïî½ÓÊÜÒ»¸öÊý×Ö±êÃ÷µ÷ÊÔ¼¶±ð¡£ÐèÒª¾¯¸æµÄÊǸߵĵ÷ÊÔ¼¶±ð¿ÉÄÜ»áÉú³É¾Þ´óµÄÈÕÖ¾Îļþ¡£ -

Èç¹û postmaster ûÓÐÔËÐУ¬Äã¿ÉÒÔÖ±½ÓÔÚÃüÁîÐÐÉÏÆô¶¯ postgres -ºǫ́½ø³Ì£¬È»ºóÖ±½Ó¼üÈë SQL Óï¾ä¡£ÎÒÃÇÖ» -ÍƼöÔÚµ÷ÊÔµÄʱºòÕâô¸É¡£Çë×¢ÒâÕâʱÓû»ÐÐÜÞ¶ø²»ÊǷֺűíʾÓï¾ä½áβ¡£Èç¹ûÄã´ø×ŵ÷ÊÔ·ûºÅ±àÒ룬Äã¿ÉÒÔʹÓÃÒ»¸öµ÷ÊÔÆ÷¹Û¿´·¢ÉúÁËʲôÊÂÇé¡£ÒòΪºǫ́½ø³ÌûÓÐÓÉ -postmaster -Æô¶¯µÄ£¬Ëü²»ÊǺÍʵ¼ÊµÄÔËÐл·¾³Ò»Ö£¬¶øÇÒËø¶¨/ºǫ́½»»¥ÎÊÌâ¿ÉÄܲ»ÄÜÖØÏÖ¡£

-

Èç¹û postmaster ÒѾ­ÔËÐУ¬¿ÉÔÚÒ»¸ö´°¿ÚÖÐÆô¶¯ -psql£¬È»ºóÕÒ³ö psql ¶ÔÓ¦µÄ postgres ½ø³ÌµÄ -PID¡£Ê¹ÓÃÒ»¸öµ÷ÊÔÆ÷¸½×ÅÔÚÕâ¸ö -postgres PID -ÉÏ¡£Äã¿ÉÒÔÔÚµ÷ÊÔÆ÷ÀïÉèÖöϵ㲢ÇÒ´Ó psql -ÀïÖ´Ðвéѯ¡£Èç¹ûÄãÔÚµ÷ÊÔ postgres µÄÆô¶¯£¬Äã¿ÉÒÔÉèÖà -PGOPTIONS="-W n"£¬È»ºóÆô¶¯ psql¡£ÕâÑù½«µ¼ÖÂÆô¶¯ÑÓ³Ù n -Ã룬ÕâÑùÄã¾Í¿ÉÒÔ¸½¼ÓÒ»¸öµ÷ÊÔÆ÷²¢ÇÒ¸ú×ÙÆô¶¯Ë³ÐòµÄ¹ý³Ì¡£

-

postgres ³ÌÐòÓÐ -s£¬-A£¬ºÍ -t -Ñ¡Ïî¿ÉÄÜÔÚµ÷ÊÔºÍÐÔÄܲâÁ¿µÄʱºò·Ç³£ÓÐÓá£

-

Ä㻹¿ÉÒÔ´ø profiling -Ö§³Ö±àÒëºǫ́£¬ÒÔ±ã¹Û²ìÄÄЩº¯ÊýÕ¼ÓõÄÖ´ÐÐʱ¼ä½Ï¶à¡£profile -Îļþ½«·ÅÔÚ pgsql/data/base/dbname Ŀ¼Ï¡£¿Í»§¶Ë profile -Îļþ½«·ÅÔÚ¿Í»§¶Ëµ±Ç°Ä¿Â¼Ï¡£ÔÚ Linux ÏÂÖ§³Ö profiling -ÒªÔÚ±àÒëʱ¼ÓÉÏ-DLINUX_PROFILE ¡£

-

3.8) ΪʲôÔÚÊÔͼÁ¬½ÓµÇ¼ʱÊÕµ½¡°Sorry, too -many clients¡±ÏûÏ¢£¿

-

ÄãÐèÒªÔö´ó postmaster Æô¶¯Ê±Ö§³ÖµÄ²¢·¢ºǫ́½ø³ÌÊý¡£

-

ȱʡÏÞÖÆÊÇ 32 ½ø³Ì¡£Äã¿ÉÒÔͨ¹ý´ø×ÅÊʵ±µÄ -N Öµ¿ª¹ØÆô¶¯ -postmaster Ôö¼ÓÕâ¸öÊýÄ¿¡£»òÕßÐÞ¸Ä postgresql.conf Îļþ¡£

-

ҪעÒâÈç¹ûÄã°Ñ -N ÉèÖÃΪ´óÓÚ 32£¬Äã±ØÐëͬÑùÔö´ó --B£¬³¬¹ýËüȱʡµÄ 64£»-B ±ØÐë×îÉÙÊÇ -N -µÄÁ½±¶£¬¶øÇÒΪÁ˸üºÃµÄÐÔÄÜ¿ÉÄÜÒª±ÈÄǸöÊý×ÖÒª´ó¡£¶ÔÓÚ´óÊýÄ¿µÄºó¶Ë½ø³Ì£¬Äã¿ÉÄÜ»¹»á·¢ÏÖÄ㻹ÐèÒªÔö¼ÓÐí¶à -Unix -ÄÚºËÅäÖòÎÊýÖµ¡£Òª¼ì²éµÄ¶«Î÷°üÀ¨¹²ÏíÄÚ´æ¿éµÄ×î´ó³ß´ç£¬SHMMAX£¬ÐźŵƵÄ×î´óÊýÄ¿£¬SEMMNS -ºÍ SEMMNI£¬×î´óµÄ½ø³ÌÊý£¬NPROC£¬µ¥Óû§×î´ó½ø³ÌÊý£¬MAXUPRC£¬ÒÔ¼°´ò¿ªÎļþµÄ×î´óÊýÄ¿£¬NFILE ºÍ NINODE ¡£Postgres -¶ÔÔÊÐíµÄºǫ́½ø³ÌÊýÓÐÏÞÖƵÄÔ­ÒòÊÇΪÁËÈ·±£ÄãµÄϵͳ²»»áÓùâ×ÊÔ´¡£

-

ÔÚ Postgres ÔçÓÚ 6.5 µÄ°æ±¾£¬×î´óºǫ́½ø³ÌÊýȱʡÊÇ -64£¬²¢ÇÒ¶ÔËüµÄÐÞ¸ÄÊ×ÏÈÐèÒªÐÞ¸Ä include/storage/sinvaladt.h -ÀïµÄ MaxBackendId ³£Á¿£¬È»ºóÖØРBUILD¡£

-

3.9) pgsql_tmp Ŀ¼ÀﶼÓÐЩʲô£¿

-

¸ÃĿ¼Ï±£´æÁ˲éѯִÐÐÆ÷Éú³ÉµÄÁÙʱÎļþ¡£ÀýÈ磬Èç¹ûÐèҪΪÂú×ã -ORDER BY Ìõ¼þ×öÅÅÐò£¬²¢ÇÒÅÅÐòÐèÒª±Èºǫ́µÄ -S -²ÎÊý¸ø³öµÄ¸ü¶àµÄ¿Õ¼ä£¬ÄÇô¾Í»á´´½¨Ò»¸öÁÙʱÎļþ±£´æ¶à³öÀ´µÄÊý¾Ý¡£

-

-ÁÙʱÎļþÓ¦¸Ã×Ô¶¯É¾³ý£¬²»¹ýÈç¹ûÔÚÅÅÐò¹ý³ÌÖкǫ́±ÀÀ£Á˾ͿÉÄÜÁôÏÂÀ´¡£Í£Ö¹²¢ÖØÆð -postmaster ½«»áɾ³ýÕâЩÎļþ¡£

-

3.10) ΪʲôҪÔÚÉý¼¶ PostgreSQL ·¢²¼°æ±¾Ê±×ö -dump ºÍ restore £¿

-

PostgreSQL ¿ª·¢×é¶Ôÿ´ÎСµÄÉý¼¶½ö×öÁ˽ÏÉÙµÄÐÞ¸Ä,Òò´Ë´Ó 7.2 -Éý¼¶µ½ 7.2.1 ²»ÐèÒª dump ºÍ restore¡£µ«ÊÇÖ÷ÒªµÄÉý¼¶£¨ÀýÈç´Ó 7.2 µ½ -7.3£©Í¨³£»áÐÞ¸Äϵͳ±íºÍÊý¾Ý±íµÄÄÚ²¿¸ñʽ¡£ÕâЩ±ä»¯Ò»°ã±È½Ï¸´ÔÓ£¬Òò´ËÎÒÃDz»Î¬Êý¾ÝÎļþµÄÏòºó¼æÈÝ¡£dump -½«Êý¾Ý°´ÕÕͨÓõĸñʽÊä³ö£¬Ëæºó¿ÉÒÔ±»ÖØмÓÔز¢Ê¹ÓÃеÄÄÚ²¿¸ñʽ¡£

-

´ÅÅÌÎļþ¸ñʽûÓб仯µÄÉý¼¶£¬¿ÉÒÔÓà pg_upgrade -½Å±¾£¬¶ø²»ÐèÒª×ö dump ºÍ restor¡£·¢²¼ËµÃ÷script »áÖ¸Ã÷ -pg_upgrade ¶Ô¸Ã´ÎÉý¼¶ÊÇ·ñ¿ÉÓá£

-
-
-

²Ù×÷ÎÊÌâ

-
-

4.1) -¶þ½øÖÆÓαêºÍÆÕͨÓαêÖ®¼äµÄÇø±ðÊÇʲô£¿

-²ÎÔÄ DECLARE ÊÖ²áÒ³»ñÈ¡ÐÅÏ¢¡£ -

4.2)ÈçºÎÖ» SELECT -Ò»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿

-²ÎÔÄ FETCH ÊÖ²áÒ³£¬»òÕßʹÓà SELECT ... -LIMIT.... -

¼´Ê¹ÄãÖ»ÐèÒª¿ªÍ·µÄ¼¸ÐУ¬Ò²»áÉæ¼°µ½Õû¸ö²éѯ¡£ÊÔ×ÅʹÓôøÓÐ -ORDER BY µÄ²éѯ¡£Èç¹ûÓÐÒ»¸öË÷ÒýÓë -ORDER BY Æ¥Å䣬PostgreSQL -¿ÉÄܾÍÖ»´¦ÀíÒªÇóµÄÍ·¼¸Ìõ¼Ç¼£¬·ñÔò½«¶ÔÕû¸ö²éѯ½øÐд¦ÀíÖ±µ½Éú³ÉÐèÒªµÄÐС£

-

4.3) ÎÒÈçºÎ»ñÈ¡Ò»¸ö±íµÄÁÐ±í£¬»òÕßÊÇÆäËûÎÒÄÜÔÚ -psql Àï¿´µ½µÄ¶«Î÷£¿

-Äã¿ÉÒÔÔĶÁ psql -µÄÔ´´úÂëÎļþpgsql/src/bin/psql/describe.c ¡£Ëü°üÀ¨ÎªÉú³É -psql µÄ·´Ð±¸ÜÃüÁîµÄÊä³öµÄ SQL ÃüÁî¡£Ä㻹¿ÉÒÔ´ø -E Ñ¡ÏîÆô¶¯ -psql£¬ÕâÑùËü½«´òÓ¡³öÖ´ÐÐÄã¸ø³öµÄÃüÁîËùÓõIJéѯ¡£ -

4.4) ÔõÑù´Ó±íÀïÃæɾ³ýÒ»ÁУ¿

-

7.3 ÀïÔö¼ÓÁË ALTER TABLE DROP -COLUMN£¬ÒÔÖ§³Ö´ËÏÄÜ¡£ÔÚÒÔÇ°µÄ°æ±¾ÖУ¬¿ÉÒÔÕâÑù×ö£º

-
-    BEGIN;
-    LOCK TABLE old_table;
-    SELECT ...  -- select all columns but the one you want to remove
-    INTO TABLE new_table
-    FROM old_table;
-    DROP TABLE old_table;
-    ALTER TABLE new_table RENAME TO old_table;
-    COMMIT;
-
-

4.5) -Ò»ÐУ¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿

-ÏÂÃæÊÇһЩÏÞÖÆ£º -
-    Ò»¸öÊý¾Ý¿â×î´ó³ß´ç£¿   ÎÞÏÞÖÆ£¨´æÔÚ 1TB µÄÊý¾Ý¿â£©
-    Ò»¸ö±íµÄ×î´ó³ß´ç£¿    16TB
-    Ò»ÐеÄ×î´ó³ß´ç£¿      1.6TB
-     Ò»¸ö×ֶεÄ×î´ó³ß´ç?   1GB
-    Ò»¸ö±íÀï×î´óÐÐÊý£¿     ÎÞÏÞÖÆ
-    Ò»¸ö±íÀï×î´óÁÐÊý£¿     ¸úÁÐÀàÐÍÓйØ,250-1600
-    Ò»¸ö±íÀïµÄ×î´óË÷ÒýÊýÁ¿£¿ÎÞÏÞÖÆ
-
-µ±È»£¬Êµ¼ÊÉÏûÓÐÕæÕýµÄÎÞÏÞÖÆ£¬»¹ÊÇÒªÊÜ¿ÉÓôÅÅ̿ռ䡢¿ÉÓÃÄÚ´æ/½»»»ÇøµÄÖÆÔ¼¡£ -

±íµÄ×î´ó³ß´ç 16 TB ²»ÐèÒª²Ù×÷ϵͳ¶Ô´óÎļþµÄÖ§³Ö¡£´ó±íÓöà¸ö 1 GB -µÄÎļþ´æ´¢£¬Òò´ËÎļþϵͳ³ß´çµÄÏÞÖÆÊDz»ÖØÒªµÄ¡£

-

Èç¹ûȱʡµÄ¿é´óСÔö³¤µ½ 32K -£¬×î´óµÄ±í³ß´çºÍ×î´óÁÐÊý¿ÉÒÔÔö¼Ó¡£

-

4.6)´æ´¢Ò»¸öµäÐ͵ÄƽÃæÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿

-Ò»¸ö Postgres -Êý¾Ý¿â×î¶à¿ÉÄÜÐèÒªÏ൱ÓÚÔÚÒ»¸öƽÃæÎļþÀï´æ´¢ÏàͬÊý¾ÝµÄ5±¶µÄ´ÅÅ̿ռ䡣 -

ÀýÈ磬¼ÙÉèÓÐÒ»¸ö 100,000 -ÐеÄÎļþ£¬Ã¿ÐÐÓÐÒ»¸öÕûÊýºÍÒ»¸öÎı¾ÃèÊö¡£¼ÙÉèÎı¾´®µÄƽ¾ù³¤¶Èλ20×Ö½Ú¡£Æ½ÃæÎļþÕ¼Óà -2.8 MB¡£´æ·ÅÕâЩÊý¾ÝµÄ PostgreSQL Êý¾Ý¿âÎļþ´óÔ¼ÊÇ 6.4 MB:

-
-     36 ×Ö½Ú: ÿÐеÄÍ·£¨¹À¼ÆÖµ£©
-     24 ×Ö½Ú: Ò»¸öint×ֶκÍÒ»¸öÎı¾ÐÍ×Ö¶Î
-   +  4 ×Ö½Ú: Ò³ÃæÄÚÖ¸ÏòÔª×éµÄÖ¸Õë
-   ----------------------------------------
-     64 ×Ö½ÚÿÐÐ
-
-   PostgreSQL Êý¾ÝÒ³µÄ´óСÊÇ 8192 ×Ö½Ú (8 KB)£¬Ôò£º
-
-   8192 ×Ö½Úÿҳ
-   -------------------   =  128 ÐÐ/Êý¾ÝÒ³£¨ÏòÏÂÈ¡Õû£©
-     64 ×Ö½ÚÿÐÐ
-
-   100000 Êý¾ÝÐÐ
-   --------------------  =  782 Êý¾ÝÒ³£¨ÏòÉÏÈ¡Õû£©
-      128 ÐÐÿҳ
-
-   782 Êý¾ÝÒ³ * 8192 ×Ö½Ú/Ò³  =  6,406,144 ×Ö½Ú£¨6.4 MB£©
-
-

-Ë÷Òý²»ÐèÒªÕâô¶àµÄ¶îÍâÏûºÄ£¬µ«Ò²È·Êµ°üÀ¨±»Ë÷ÒýµÄÊý¾Ý£¬Òò´ËËüÃÇÒ²¿ÉÄܴܺó¡£

-

¿ÕÖµ´æ·ÅÔÚλͼÖУ¬Òò´ËÕ¼ÓúÜÉٵĿռ䡣

-

4.7) -ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿

- psql ÓÐÐí¶à·´Ð±¸ÜÃüÁîÓÃÓÚÏÔʾÕâЩÐÅÏ¢¡£Óà \? -¿´¿´¶¼ÓÐÄÄЩ¡£ÒÔ pg_ ´òÍ·µÄϵͳ±íÒ²ÃèÊöÁËÕâЩÐÅÏ¢¡£ psql -l -¿ÉÒÔÁгöËùÓеÄÊý¾Ý¿â¡£ -

Ò²¿ÉÒÔÊÔÊÔÎļþ -pgsql/src/tutorial/syscat.source¡£ËüÑÝʾÁËÐí¶à´ÓÊý¾Ý¿âϵͳ±íÀï»ñÈ¡ÐÅÏ¢ÐèÒªµÄ -SELECT¡£

-

4.8) -ÎҵIJéѯºÜÂý»òÕßûÓÐÀûÓÃË÷Òý¡£ÎªÊ²Ã´£¿

-

-²¢·Çÿ¸ö²éѯ¶¼»á×Ô¶¯Ê¹ÓÃË÷Òý¡£Ö»ÓÐÔÚ±íµÄ´óС³¬¹ýÒ»¸ö×îСֵ£¬²¢ÇÒ²éѯֻѡÔñ±íÖнÏС±ÈÀýµÄÐÐʱ²ÉÓÃʹÓÃË÷Òý¡£ÕâÊÇÒòΪË÷ÒýɨÃèÒýÆðµÄËæ¼´´ÅÅÌ´æÈ¡¿ÉÄܱÈÖ±½ÓµØ¶ÁÈ¡±í£¨Ë³ÐòɨÃ裩¸üÂý¡£ÎªÁËÅжÏÊÇ·ñʹÓÃË÷Òý£¬PostgreSQL -±ØÐë»ñµÃÓйرíµÄͳ¼ÆÖµ¡£ÕâЩͳ¼ÆÖµ¿ÉÒÔʹÓà VACUUM ANALYZE£¬»ò -ANALYZE -»ñµÃ¡£Ê¹ÓÃͳ¼ÆÖµ£¬ÓÅ»¯Æ÷ÖªµÀ±íÖÐÓжàÉÙÐУ¬¾ÍÄܹ»¸üºÃµØÅжÏÊÇ·ñÀûÓÃË÷Òý¡£Í³¼ÆÖµ¶ÔÈ·¶¨ÓÅ»¯µÄÁ¬½Ó˳ÐòºÍÁ¬½Ó·½·¨Ò²ºÜÓÐÓá£ÔÚ±íµÄÄÚÈÝ·¢Éú±ä»¯Ê±£¬Ó¦¶¨ÆÚ½øÐÐͳ¼ÆÖµµÄ»ñÈ¡¡£

-

Ë÷Òýͨ³£²»ÓÃÓÚ ORDER BY -»òÖ´ÐÐÁ¬½Ó¡£¶ÔÒ»¸ö´ó±íµÄÒ»´Î˳ÐòɨÃ裬ÔÙ×öÒ»¸öÏÔʽµÄÅÅÐòͨ³£±ÈË÷ÒýɨÃèÒª¿ì¡£

-

µ«ÊÇ£¬ÔÚ LIMIT ºÍ ORDER BY -½áºÏʹÓÃʱ¾­³£»áʹÓÃË÷Òý£¬ÒòΪֻ»á·µ»Ø±íµÄһС²¿·Ö¡£Êµ¼ÊÉÏ£¬ËäÈ» -MAX() ºÍ MIN() ²¢²»Ê¹ÓÃË÷Òý£¬Í¨¹ý¶Ô ORDER BY ºÍ LLIMIT -ʹÓÃË÷ÒýÈ¡µÃ×î´óÖµºÍ×îСֵҲÊÇ¿ÉÒԵģº
-
- SELECT col
- FROM tab
- ORDER BY col [ DESC ]
- LIMIT 1;

-

µ±Ê¹ÓÃͨÅä·û²Ù×÷£¬ÀýÈç LIKE »ò ~ -ʱ£¬Ë÷ÒýÖ»ÄÜÔÚÌض¨µÄÇé¿öÏÂʹÓãº

- -

4.9) -ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑù´¦ÀíÎҵIJéѯµÄ£¿

-²Î¿¼ EXPLAIN ÊÖ²áÒ³¡£ -

4.10) R-tree Ë÷ÒýÊÇʲô£¿

-

R-tree Ë÷ÒýÓÃÓÚË÷Òý¿Õ¼äÊý¾Ý¡£Ò»¸ö¹þÏ£Ë÷ÒýÎÞ·¨´¦Àí·¶Î§ËÑË÷¡£¶ø -B-tree Ë÷ÒýÖ»ÄÜ´¦ÀíһάµÄ·¶Î§ËÑË÷¡£R-tree -Ë÷Òý¿ÉÒÔ´¦Àí¶àάÊý¾Ý¡£ÀýÈ磬Èç¹û¿ÉÒÔÔÚÒ»¸öÀàÐÍΪ point -µÄ×Ö¶ÎÉϽ¨Á¢Ò»¸ö R-tree Ë÷Òý£¬ÄÇôϵͳÄܸü¸ßЧµØ»Ø´ðÀàËÆ -¡°Ñ¡ÔñÔÚÒ»¸ö³¤·½Ðη¶Î§ÄÚµÄËùÓе㡱¡£
-
-ÃèÊö×î³õµÄ R-Tree Éè¼ÆµÄÕýʽÂÛÎÄÊÇ£º
-
-Guttman, A. "R-Trees: A Dynamic Index Structure for Spatial -Searching." Proc of the 1984 ACM SIGMOD Int'l Conf on Mgmt of Data, -45-57.
-
-Ä㻹¿ÉÒÔÔÚ Stonebraker µÄ¡°Readings in Database -Systems¡±ÀïÕÒµ½ÕâƪÎÄÕ¡£
-
-ϵͳÄÚÖÃµÄ R-Tree ¿ÉÒÔ´¦Àí¶à±ßÐκͷ½ÐΡ£ÀíÂÛÉÏ˵£¬R-tree -¿ÉÒÔÀ©Õ¹Îª´¦Àí¸ü¶àάÊý¡£²»¹ýÔÚʵ¼ùÉÏ£¬À©Õ¹ R-trees -ÐèÒªÒ»¶¨µÄ¹¤×÷Á¿£¬¶øÎÒÃÇĿǰûÓÐÈçºÎ×öµÄÎĵµ¡£

-

4.11) ʲôÊÇ»ùÒò²éѯÓÅ»¯£¨Genetic Query -Optimization£©£¿

-

GEQO Ä£¿é²ÉÓûùÒòËã·¨£¨Genetic -Algorithm£¬GA£©¼Ó¿ì¶à±íÁ¬½ÓµÄ²éѯÓÅ»¯¡£ËüÔÊÐíͨ¹ý·ÇÇî¾ÙËÑË÷´¦Àí´óµÄÁ¬½Ó²éѯ¡£

-

4.12) -ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽËÑË÷£¿ÔõÑùÀûÓÃË÷Òý½øÐдóСдÎÞ¹ØËÑË÷£¿

-

²Ù×÷·û ~ ´¦ÀíÕýÔò±í´ïʽƥÅ䣬¶ø ~* -´¦Àí´óСдÎ޹صÄÕýÔò±í´ïʽƥÅä¡£´óдЩÎÞ¹ØµÄ LIKE ±äÖÖ³ÉΪ -ILIKE¡£
-
-´óСдÎ޹صĵÈʽ±È½Ïͨ³£Ð´×ö£º
-
- SELECT *
- FROM tab
- WHERE lower(col) = 'abc';
-
-ÕâÑù½«²»»áʹÓñê×¼µÄË÷Òý¡£µ«ÊÇ¿ÉÒÔ´´½¨Ò»¸ö¿É±»ÀûÓõĺ¯ÊýË÷Òý:
-
- CREATE INDEX tabindex ON tab (lower(col));

-

4.13) ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ -NULL£¿

-

Óà IS NULL ºÍ IS NOT NULL ²âÊÔÕâ¸ö×ֶΡ£

-

4.14) ¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿

-

ÀàÐÍ ÄÚ²¿Ãû³Æ ˵Ã÷
- --------------------------------------------------
- "char" char 1¸ö×Ö·û character
- CHAR(#) bpchar -¶¨³¤×Ö·û´®£¬Êµ¼ÊÊý¾Ý²»×㶨Ò峤¶Èʱ£¬ÒÔ¿Õ¸ñ²¹Æë
- VARCHAR(#) varchar -Ö¸¶¨ÁË×î´ó³¤¶È£¬±ä³¤×Ö·û´®£¬²»×㶨Ò峤¶ÈµÄ²¿·Ö²»²¹Æë
- TEXT text ´®³¤¶È½öÊÜÐеÄ×î´ó³¤¶ÈÏÞÖÆ
- BYTEA bytea ±ä³¤×Ö½ÚÐòÁУ¨±ä³¤µÄ¶þ½øÖÆÊý¾Ý£©
-
-ÔÚϵͳ±íºÍÔÚһЩ´íÎóÐÅÏ¢ÀïÄ㽫¿´µ½ÄÚ²¿Ãû³Æ¡£
-
-ÉÏÃæ×îºóËÄÖÖÀàÐÍÊÇ"varlena"£¨±ä³¤£©ÀàÐÍ£¨Ò²¾ÍÊÇ˵£¬¿ªÍ·µÄËĸö×Ö½ÚÊdz¤¶È£¬ºóÃæ²ÅÊÇÊý¾Ý£©¡£ÓÚÊÇʵ¼ÊÕ¼ÓõĿռä±ÈÉùÃ÷µÄ´óСҪ¶àһЩ¡£È»¶øÕâЩÀàÐͶ¼¿ÉÒÔ±»Ñ¹Ëõ´æ´¢£¬Ò²¿ÉÒÔÓà -TOAST ÍÑ»ú´æ´¢£¬Òò´Ë´ÅÅÌ¿Õ¼äÒ²¿ÉÄܱÈÔ¤ÏëµÄÒªÉÙ¡£
-
-CHAR(n) ×îÊʺÏÓÚ´æ´¢³¤¶È»ù±¾²î²»¶àµÄ×Ö·û´®¡£VARCHAR(n) -ÔÚ´æ´¢ÏÞÖÆÁË×î´ó³¤¶ÈµÄ±ä³¤×Ö·û´®ÊÇ×îºÃµÄ¡£TEXT -ÊÊÓÃÓÚ´æ´¢²»ÏÞÖƳ¤¶ÈµÄ×Ö·û´®£¬×î´ó¿É´ï 1G¡£BYTEA -ÓÃÓÚ´æ´¢¶þ½øÖÆÊý¾Ý£¬ÓÈÆäÊÇ°üº¬ NULL -×Ö½Ú£¨¶þ½øÖƵÄ0£©µÄÖµ¡£ÕâЩÀàÐ;ßÓÐÀàÐ͵ÄÐÔÄÜ¡£

-

4.15.1) -ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿

-

PostgreSQL Ö§³Ö SERIAL -Êý¾ÝÀàÐÍ¡£ËüÔÚ×Ö¶ÎÉÏ×Ô¶¯´´½¨Ò»¸öÐòÁкÍË÷Òý¡£ÀýÈ磬
- CREATE TABLE person (
- id SERIAL,
- name TEXT
- );
-
-»á×Ô¶¯×ª»»Îª£º
-
- CREATE SEQUENCE person_id_seq;
- CREATE TABLE person (
- id INT4 NOT NULL DEFAULT nextval('person_id_seq'),
- name TEXT
- );
- CREATE UNIQUE INDEX person_id_key ON person ( id );
-
-²Î¿¼ create_sequence ÊÖ²áÒ³»ñÈ¡¹ØÓÚÐòÁеĸü¶àÐÅÏ¢¡£Ä㻹¿ÉÒÔÓÃÿÐÐµÄ -oid -×Ö¶Î×÷Ϊһ¸öΨһֵ¡£²»¹ý£¬Èç¹ûÄãÐèÒªÇãµ¹ºÍÖØÔØÊý¾Ý¿â£¬ÄãÐèҪʹÓà -pg_dump µÄ -o Ñ¡Ïî»òÕß COPY WITH OIDS Ñ¡ÏîÒÔ±£Áô OID¡£

-

4.15.2) -ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿

-

Ò»ÖÖ·½·¨ÊÇÔÚ²åÈë֮ǰÏÈÓú¯Êý nextval() ´ÓÐòÁжÔÏóÀï¼ìË÷³öÏÂÒ»¸ö -SERIAL Öµ£¬È»ºóÔÙÏÔʽ²åÈ롣ʹÓà 4.15.1 -ÀïµÄÀý±í£¬¿ÉÓÃαÂëÕâÑùÃèÊö£º
-
- new_id = execute("SELECT nextval('person_id_seq')");
- execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise -Pascal')");
-
-ÕâÑù»¹ÄÜÔÚÆäËû²éѯÖÐʹÓôæ·ÅÔÚ new_id ÀïµÄÐÂÖµ£¨ÀýÈ磬×÷Ϊ person -±íµÄÍâ¼ü£©¡£×¢Òâ×Ô¶¯´´½¨µÄ SEQUENCE ¶ÔÏóµÄÃû³Æ½«»áÊÇ -<table>_<serialcolumn>_seq£¬ÕâÀï table ºÍ serialcolumn -·Ö±ðÊÇÄãµÄ±íµÄÃû³ÆºÍÄãµÄ SERIAL ×ֶεÄÃû³Æ¡£
-
-ÀàËƵģ¬ÔÚ SERIAL ¶ÔÏóȱʡ²åÈëºóÄã¿ÉÒÔÓú¯Êý currval() ¼ìË÷¸Õ¸³ÖµµÄ -SERIAL Öµ£¬ÀýÈ磬
-
- execute("INSERT INTO person (name) VALUES ('Blaise -Pascal')");
- new_id = execute("SELECT currval('person_id_seq')");
-
-×îºó£¬Äã¿ÉÒÔʹÓÃ´Ó INSERT Óï¾ä·µ»ØµÄ OID -²éÕÒȱʡֵ£¬¾¡¹ÜÕâ¿ÉÄÜÊÇ×îȱ·¦ÒÆÖ²ÐԵķ½·¨¡£ÔÚ Perl ÀʹÓôøÓÐ -Edmund Mergl µÄ DBD::Pg Ä£¿éµÄ DBI£¬oid Öµ¿ÉÒÔͨ¹ý -$sth->execute() ºóµÄ $sth->{pg_oid_status} »ñµÃ¡£

-

4.15.3) ʹÓà currval() ºÍ nextval() -»áµ¼ÖÂÒ»¸öÓëÆäËûÓû§Ö®¼äµÄÎÉÂÒÇé¿öÂð£¿

-

²»»á¡£currval() -·µ»Øºǫ́½ø³Ì¶ø²»ÊÇËùÓÐÓû§¸³ÓèµÄµ±Ç°Öµ¡£

-

4.15.4) -Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖдæÔÚ¼ä¶ÏÄØ£¿

-

-ΪÁËÌá¸ß²¢·¢ÐÔ£¬ÐòÁкÅÔÚÐèÒªµÄʱºò¸³ÓèÕýÔÚÔËÐеÄÊÂÎñ£¬²¢ÇÒÖ»ÔÚÊÂÎñ½áÊø֮ǰ²»·âËø¡£Õâ¾Í»áµ¼ÖÂزÕÛÊÂÎñºóµÄÐòÁкųöÏÖ¼ä¸ô¡£

-


-4.16) ʲôÊÇ OID£¿Ê²Ã´ÊÇ TID£¿

-

OID ÊÇ PostgreSQL ÖÐÐеÄΨһ±êʶ¡£PostgreSQL -Àï´´½¨µÄÿһÐж¼»ñµÃÒ»¸öΨһµÄ OID¡£ËùÓÐÔÚ initdb ¹ý³ÌÖд´½¨µÄ OID -¶¼Ð¡ÓÚ 16384 £¨²Î¼û include/access/transam.h£©¡£ËùÓÐÓû§´´½¨µÄ OID -¶¼´óÓÚ»òµÈÓÚÕâ¸öÖµ¡£È±Ê¡Ê±£¬ËùÓÐÕâЩ OID -²»½öÔÚÒ»¸ö±í»òÒ»¸öÊý¾Ý¿âÀïÃæΨһ£¬¶øÇÒÔÚÕû¸ö PostgreSQL -°²×°ÀïÒ²ÊÇΨһµÄ¡£
-
-PostgreSQL ÔÚËüµÄÄÚ²¿ÏµÍ³±íÀïʹÓà OID ÔÚ±íÖ®¼ä½¨Á¢ÁªÏµ¡£ÕâЩ OID -¿ÉÒÔÓÃÓÚ±êʶÌض¨µÄÓû§ÐÐÒÔ¼°ÓÃÔÚÁ¬½ÓÀï¡£½¨ÒéʹÓÃ×Ö¶ÎÀàÐÍ OID ´æ´¢ -OID Öµ¡£¿ÉÒÔÔÚ OID ×Ö¶ÎÉÏ´´½¨Ò»¸öË÷ÒýÒÔ¿ìËÙ·ÃÎÊ¡£
-
-OID ´ÓÒ»¸ö±»ËùÓÐÊý¾Ý¿âʹÓõÄÖÐÐÄÇøÓòÀ︳ֵ¸øËùÓÐÐÂÐС£Èç¹ûÄãÏë°Ñ -OID ¸Ä³É±ðµÄÖµ£¬»òÕßÏë×öÒ»·Ý±íµÄ´øԭʼ OID µÄ¿½±´£¬Äã¿ÉÒÔ×öµ½£º -
-
- CREATE TABLE new(old_oid oid, mycol int);
- SELECT old_oid, mycol INTO new FROM old;
- COPY new TO '/tmp/pgtable';
- DELETE FROM new;
- COPY new WITH OIDS FROM '/tmp/pgtable';
-
-OID -ÓÃ4×Ö½ÚµÄÕûÊý±£´æ£¬ÔÚ³¬¹ý40ÒÚʱ½«Òç³ö¡£Ã»ÓÐÈ˱¨¸æ³öÏÖ¹ýÒç³ö£¬¶øÎÒÃÇ´òËãÔÚÓÐÈ˱¨¸æ֮ǰÏû³ýÕâ¸öÏÞÖÆ¡£
- -
-TID ÓÃÓÚ±êʶ´ø×ÅÊý¾Ý¿é£¨µØÖ·£©ºÍ£¨¿éÄÚ£©Æ«ÒƵÄÌض¨µÄÎïÀíÐС£TID -ÔÚÐб»¸ü¸Ä»òÖØÔغó·¢Éú¸Ä±ä¡£Ë÷ÒýÈë¿ÚʹÓÃËüÃÇÖ¸ÏòÎïÀíÐС£

-

4.17) PostgreSQL -ʹÓõÄһЩÊõÓïµÄº¬ÒåÊÇʲô£¿

-

-һЩԴ´úÂëºÍһЩ¾ÉÒ»µãµÄÎĵµÊ¹ÓÃһЩÓиü³£ÓÃÓ÷¨µÄÊõÓï¡£ÏÂÃæÊÇÆäÖÐÒ»²¿·Ö£º -
- table, relation, class
- row, record, tuple
- column, field, attribute
- retrieve, select
- replace, update
- append, insert
- OID, serial value
- portal, cursor
- range variable, table name, table alias
-
-ÓÐÒ»¸öͨÓÃÊý¾Ý¿âÊõÓïµÄÁÐ±í£ºhttp://hea-www.harvard.edu/MST/simul/software/docs/pkgs/pgsql/glossary/glossary.html -¡£

-

4.18) ΪʲôÎÒÊÕµ½´íÎó¡°ERROR: Memory -exhausted in AllocSetAlloc()¡±£¿

-

-ÕâºÜ¿ÉÄÜÊÇϵͳµÄÐéÄâÄÚ´æÓùâÁË£¬»òÕßÄں˶ÔijЩ×ÊÔ´Óнϵ͵ÄÏÞÖÆÖµ¡£ÔÚÆô¶¯ -postmaster ֮ǰÊÔÊÔÏÂÃæµÄÃüÁ
-
- ulimit -d 262144
- limit datasize 256m
-
-È¡¾öÓÚÄãÓÃµÄ -shell£¬ÉÏÃæÃüÁîÖ»ÓÐÒ»ÌõÄܳɹ¦£¬µ«ÊÇËü½«°ÑÄãµÄ½ø³ÌÊý¾Ý¶ÎÏÞÖÆÉèµÃ±È½Ï¸ß£¬Òò¶øÒ²ÐíÄÜÈòéѯÍê³É¡£ÕâÌõÃüÁîÓ¦ÓÃÓÚµ±Ç°½ø³Ì£¬ÒÔ¼°ËùÓÐÔÚÕâÌõÃüÁîÔËÐк󴴽¨µÄ×Ó½ø³Ì¡£Èç¹ûÄãÊÇÔÚÔËÐÐSQL¿Í»§¶ËʱÒòΪºǫ́·µ»ØÁËÌ«¶àµÄÊý¾Ý¶ø³öÏÖÎÊÌ⣬ÇëÔÚÔËÐпͻ§¶Ë֮ǰִÐÐÉÏÊöÃüÁî¡£

-

4.19) ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL -µÄ°æ±¾£¿

-

´Ó psql À¼üÈë SELECT version()£»

-

4.20) -ΪʲôÎҵĴó¶ÔÏó²Ù×÷µ¼Ö´íÎó¡°invalid large obj -descriptor¡±£¨·Ç·¨µÄ´ó¶ÔÏóÃèÊö·û£©£¿

-

ÄãÐèÒªÔÚʹÓÃÈκδó¶ÔÏó¾ä±úµÄÇ°ºó·ÅÉÏ BEGIN WORK ºÍ -COMMIT£¬Ò²¾ÍÊÇ˵£¬°üΧ lo_open ... lo_close¡£
-
-Ä¿Ç° PostgreSQL -Ç¿ÖÆʵʩÕâÌõ¹æÔò£ºÔÚÊÂÎñÌύʱ¹Ø±Õ´ó¶ÔÏó¾ä±ú£¬ÕâÑù£¬£¨Ã»ÓвÉÓÃÊÂÎñʱ£©£¬Ê״ζԴó¶ÔÏó¾ä±ú×öÈκÎÊÂÇéµÄÆóͼ¶¼»áµ¼ÖÂÒ»¸ö -invalid large obj -descriptor¡£ËùÒÔ£¬Èç¹ûÄãûÓÐʹÓÃÒ»¸öÊÂÎñ£¬ÒÔÇ°Äܹ¤×÷µÄ´úÂ루ÖÁÉÙÊÇ´ó¶àÊýʱ¼ä£©½«»áÉú³ÉÕâôһ¸ö´íÎóÐÅÏ¢¡£ -
-
-Èç¹ûÄãʹÓÿͻ§¶Ë½Ó¿Ú£¬Èç ODBC£¬Äã¿ÉÄÜÐèÒª set auto-commit off¡£

-

4.21) -ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿

-

ʹÓà CURRENT_TIMESTAMP£º
-
- CREATE TABLE test(x int, modtime timestamp DEFAULT -CURRENT_TIMESTAMP);

-

4.22) ΪʲôʹÓà IN µÄ×Ó²éѯÕâôÂý£¿

-

-Ä¿Ç°£¬ÎÒÃÇͨ¹ýΪÍâ²éѯµÄÿһÐÐ˳ÐòɨÃè×Ó²éѯµÄ½á¹ûÀ´Á¬½Ó×Ó²éѯºÍÍâ²éѯ¡£Èç¹û×Ó²éѯ·µ»ØÉÙÊý¼¸ÐУ¬¶øÍâ²éѯ·µ»ØºÜ¶àÐУ¬IN -Ö´Ðеúܿ졣ΪÁ˼ӿìÆäËû IN ²éѯµÄÖ´ÐУ¬¿ÉÒÔÓà EXISTS Ìæ»» IN£º -
-
- SELECT *
- FROM tab
- WHERE col IN (SELECT subcol FROM subtab);
-
-¸ÄΪ£º
-
- SELECT *
- FROM tab
- WHERE EXISTS (SELECT subcol FROM subtab WHERE subcol = -col);
-
-ºóÕßÒªÏëÖ´Ðеøü¿ì£¬subcol -Ó¦¸ÃÊÇÒ»¸öË÷ÒýÁС£ÎÒÃÇÏ£ÍûÔÚδÀ´µÄ·¢²¼°æ±¾ÖÐÐÞ²¹Õâ¸öÏÞÖÆ¡£

-

4.23) ÎÒÔõÑù½øÐÐ outer join -£¨ÍâÁ¬½Ó£©£¿

-

PostgreSQL ²ÉÓñê×¼µÄ SQL Óï·¨Ö§³ÖÍâÁ¬½Ó¡£ÕâÀïÊÇÁ½¸öÀý×Ó£º
-
- SELECT *
- FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
-
-»ò
- SELECT *
- FROM t1 LEFT OUTER JOIN t2 USING (col);
-
-ÕâÁ½¸öµÈ¼ÛµÄ²éѯÔÚ t1.col ºÍ t2.col ÉÏ×öÁ¬½Ó£¬²¢ÇÒ·µâ»?t1 -ÖÐËùÓÐδÁ¬½ÓµÄÐУ¨ÄÇЩÔÚ t2 ÖÐûÓÐÆ¥ÅäµÄÐУ©¡£ÓÒ[Íâ]Á¬½Ó(RIGHT -OUTER JOIN)½«·µ»Ø t2 ÖÐδÁ¬½ÓµÄÐС£ÍêÈ«ÍâÁ¬½Ó£¨FULL OUTER -JOIN£©½«·µ»Ø t1 ºÍ t2 ÖÐδÁ¬½ÓµÄÐС£¹Ø¼ü×Ö OUTER -ÔÚ×ó[Íâ]Á¬½Ó¡¢ÓÒ[Íâ]Á¬½ÓºÍÍêÈ«[Íâ]Á¬½ÓÖÐÊÇ¿ÉÑ¡µÄ£¬ÆÕͨÁ¬½Ó±»³ÉΪÄÚÁ¬½Ó£¨INNER -JOIN£©¡£
-
-ÔÚ´ËÇ°µÄ°æ±¾ÖУ¬ÍâÁ¬½Ó¿ÉÒÔÓà UNION ºÍ NOT IN -À´Ä£Äâ¡£ÀýÈ磬ÏÂÃæµÄÀý×ÓÔÚ±í tab1 ºÍ tab2 Ö®¼ä×öÍâÁ¬½Ó£º
-
- SELECT tab1.col1, tab2.col2
- FROM tab1, tab2
- WHERE tab1.col1 = tab2.col1
-
- UNION ALL
-
- SELECT tab1.col1, NULL
- FROM tab1
- WHERE tab1.col1 NOT IN (SELECT tab2.col1 FROM tab2)
- ORDER BY col1

-

4.24) ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿

-

ûÓа취²éѯµ±Ç°Êý¾Ý¿âÖ®ÍâµÄÊý¾Ý¿â¡£ÒòΪ PostgreSQL -¼ÓÔØÊý¾Ý¿âÏà¹ØµÄϵͳĿ¼£¨ÏµÍ³±í£©£¬¿çÊý¾Ý¿âµÄ²éѯÈçºÎÖ´ÐÐҲδÃ÷È·¡£
- -
-contrib/dblink -ÔÊÐí²ÉÓú¯Êýµ÷ÓÃʵÏÖ¿ç¿â²éѯ¡£µ±È»¿ÉÒÔͬʱÁ¬½Óµ½²»Í¬µÄÊý¾Ý¿â²¢ÔÚ¿Í»§¶ËºÏ²¢½á¹û¡£

-

4.25) ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿

-

¿ÉÒÔÔÚ PL/pgSQL º¯ÊýÖÐʹÓà refcursors ·µ»Ø½á¹û¼¯¡£²Î¿´ http://www.PostgreSQL.org/idocs/index.php?plpgsql-cursors.html, -23.7.3.3½Ú¡£

-

4.26) ΪʲôÔÚ PL/PgSQL -º¯ÊýÖв»ÄÜ¿É¿¿µØ´´½¨»òɾ³ýÁÙʱ±í£¿

-

PL/PgSQL »º´æº¯ÊýµÄÄÚÈÝ£¬ÓÉ´Ë´øÀ´µÄÒ»¸ö²»ºÃµÄ¸±×÷ÓÃÊÇÈôÒ»¸ö -PL/PgSQL -º¯Êý·ÃÎÊÁËÒ»¸öÁÙʱ±í£¬È»ºó¸Ã±í±»É¾³ý²¢Öؽ¨ÁË£¬ÔòÔٴε÷Óøú¯Êý½«Ê§°Ü£¬ÒòΪ»º´æµÄº¯ÊýÄÚÈÝÈÔȻָÏò¾ÉµÄÁÙʱ±í¡£½â¾öµÄ·½·¨ÊÇÔÚ -PL/PgSQL ÖÐÓà EXECUTE -¶ÔÁÙʱ±í½øÐзÃÎÊ¡£ÕâÑù»á±£Ö¤²éѯÔÚÖ´ÐÐÇ°×ÜÊÇÖØзÖÎö¡£

-

4.27) ÓÐÄÄЩÊý¾Ý¸´ÖÆÑ¡Ï

-

-Óм¸ÖÖÖ÷/´Ó·½Ê½µÄ¸´ÖÆÑ¡Ïî¡£ÕâЩѡÏîÖ»ÔÊÐíÖ÷Êý¾Ý¿â½øÐиüУ¬´ÓÊý¾Ý¿âÖ»ÄܽøÐжÁ¡£ÍøÒ³ -http://gborg.PostgreSQL.org/genpage?replication_research - µÄ×îºóÁгöÁËÕâЩѡÏî¡£ÔÚ -http://gborg.PostgreSQL.org/project/pgreplication/projdisplay.php -ÕýÔÚ½øÐÐÒ»¸ö¶àÖ÷±¾¸´ÖƵĽâ¾ö·½°¸¡£

-

4.28) ÓÐÄÄЩÊý¾Ý¼ÓÃÜÑ¡Ï

-

contrib/pgcrypto °üº¬Á˺ܶàÔÚ SQL -²éѯÖÐʹÓõļÓÃܺ¯Êý¡£¼ÓÃÜ¿Í»§¶Ëµ½·þÎñÆ÷¶Ë´«ÊäÊý¾ÝµÄΨһ·½·¨ÊÇÔÚ -pg_hba.conf ÖвÉÓà hostss ¡£
-
-7.3 °æ±¾ÖÐ×Ô¶¯¶ÔÊý¾Ý¿âÓû§ÃÜÂë½øÐмÓÃÜ¡£ÔÚÒÔÇ°µÄ°æ±¾ÖУ¬±ØÐëÔÚ -postgresql.conf Öдò¿ª PASSWORD_ENCRYPTION -Ñ¡Ïî¡£·þÎñÆ÷¿ÉÒÔÔËÐÐÔÚ¼ÓÃܵÄÎļþϵͳÉÏ£¨ÒÔ´ïµ½¼ÓÃܵÄÄ¿µÄ£©¡£
-
---------------------------------------------------------------------------------

-

À©Õ¹ PostgreSQL

-

5.1) ÎÒдÁËÒ»¸öÓû§¶¨Ò庯Êý¡£µ±ÎÒÔÚ psql -ÀïÔËÐÐʱ£¬ÎªÊ²Ã´»áµ¼Ö core dump£¿

-

-²úÉúÕâ¸öÎÊÌâµÄÔ­ÒòºÜ¶à¡£ÇëÏÈÔÚÒ»¸öµ¥¶ÀµÄ²âÊÔ³ÌÐòÖвâÊÔÄãµÄ×Ô¶¨Ò庯Êý¡£

-

5.2) ÎÒÈçºÎÄܸø PostgreSQL -¹±Ï×һЩͦ²»´íµÄÐÂÀàÐͺͺ¯Êý£¿

-

½«ÄãµÄÀ©Õ¹·¢Ë͵½ pgsql-hackers ÓʼþÁÐ±í£¬ËüÃÇ×îÖջᱻ·Åµ½ -contrib/ ×ÓĿ¼¡£

-

5.3) ÎÒÔõÑùдһ¸ö·µ»ØÒ»ÌõÔª×éµÄ C º¯Êý£¿

-

ÔÚ PostgreSQL 7.3 ÒÔºóµÄ°æ±¾ÖУ¬C, PL/PgSQL ºÍ SQL -ÍêÈ«Ö§³Ö·µ»ØֵΪ±íµÄº¯Êý¡£¸ü¶àÐÅÏ¢Çë²Î¿¼ ³ÌÐòÔ±Ö¸ÄÏ£¨the -Programmer's Guide£©¡£ÔÚ contrib/tablefunc ÖÐÓÐÒ»¸öÀý×ÓÊÇÓà C -дµÄ·µ»ØֵΪ±íµÄº¯Êý¡£

-

5.4) -ÎÒÐÞ¸ÄÁËÒ»¸öÔ´Îļþ£¬ÎªÊ²Ã´ÖØбàÒëºóûÓп´µ½¸Ä±ä£¿

-

Makefiles ÖÐûÓаüº¬Í·ÎļþµÄÕýÈ·ÒÀÀµ¡£Äú±ØÐëÏÈ×ömake clean£¬ -ÔÙ×öÒ»´Î make ¡£Èç¹ûÄúʹÓõÄÊÇ GCC £¬Ôò¿ÉÒÔ²ÉÓÃÑ¡Ïî --enable-depend -ÈñàÒëÆ÷×Ô¶¯Éú³ÉÍ·ÎļþµÄÒÀÀµ¹Øϵ¡£

- - + + + + + PostgreSQL: PostgreSQL ³£¼ûÎÊÌ⣨FAQ£© + + + + + + +

PostgreSQL ³£¼ûÎÊÌ⣨FAQ£©

+

+×î½ü¸üУº2005 Äê 06 Ô 02 ÈÕ ÐÇÆÚÎå 22:27:35 CST +

+

+ Ŀǰά»¤ÈËÔ±£ºBruce Momjian (pgman@candle.pha.pa.us)
+ ÖÐÎÄ°æά»¤ÈËÔ±£ºdoudou586 £¨doudou586_2005@yahoo.com.cn£© +

+

+ ±¾ÎĵµµÄ×îа汾¿ÉÒÔÔÚ + http://www.postgresql.org/files/documentation/faqs/FAQ.html²é¿´¡£ +

+

+ Óë²Ù×÷ϵͳƽ̨Ïà¹ØµÄÎÊÌâÔÚhttp://www.postgresql.org/docs/faq/Àï»Ø´ð¡£
+

+
+ +

³£¼ûÎÊÌâ

+ +

+1.1)PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿
+1.2)PostgreSQL µÄ°æȨÊÇʲô£¿
+1.3)PostgreSQL ¿ÉÒÔÔËÐÐÔÚÄÄЩ²Ù×÷ϵͳƽ̨ÉÏ£¿
+1.4)ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿
+1.5)ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL µÄÖ§³Ö£¿
+1.6)ÎÒÈçºÎÌá½»Ò»¸öBUG±¨¸æ£¿
+1.7)×îаæµÄPostgreSQL ÊÇʲô£¿
+1.8)Äܹ»»ñÈ¡µÄ×îÐÂÎĵµÓÐÄÄЩ£¿
+1.9)ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG »òÔÝȱµÄ¹¦ÄÜ£¿
+1.10)ÎÒÓ¦¸ÃÔõÑùѧϰ SQL £¿
+1.11)ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿
+1.12)PostgreSQL ºÍÆäËûÊý¾Ý¿âϵͳ±ÈÆðÀ´ÈçºÎ£¿
+1.13)Ë­¿ØÖƺ͹ÜÀíPostgreSQL £¿ +

+ +

Óû§¿Í»§¶ËÎÊÌâ

+

+2.1)ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL ´ò½»µÀ£¿
+2.2)ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web Ò³Ã棿
+2.3)PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂð£¿
+

+ +

ϵͳ¹ÜÀíÎÊÌâ

+

+3.1)ÎÒÔõÑù²ÅÄÜ°Ñ PostgreSQL ×°ÔÚ /usr/local/pgsql ÒÔÍâµÄµØ·½£¿
+3.2)ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿
+3.3)ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿
+3.4)PostgreSQL Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿
+3.5)ΪʲôÔÚÊÔͼÁ¬½ÓµÇ¼ʱÊÕµ½¡°Sorry, too many clients¡± ÏûÏ¢£¿
+3.6)ΪʲôҪÔÚÉý¼¶ PostgreSQL Ö÷Òª·¢²¼°æ±¾Ê±×ö dump ºÍ restore £¿
+3.7)(ʹÓÃPostgreSQL)ÎÒÐèҪʹÓÃʲô¼ÆËã»úÓ²¼þ £¿
+

+ +

²Ù×÷ÎÊÌâ

+

+4.1)ÈçºÎֻѡÔñÒ»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿»òÊÇËæ»úµÄÒ»ÐУ¿
+4.2)ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿ÈçºÎ²é¿´psqlÀïÓõ½µÄ²éѯָÁî²¢ÏÔʾËüÃÇ£¿
+4.3)ÈçºÎ¸ü¸ÄÒ»¸ö×ֶεÄÊý¾ÝÀàÐÍ£¿
+4.4)Ò»ÐмǼ£¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿
+4.5)´æ´¢Ò»¸öµäÐ͵ÄÎı¾ÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿
+4.6)ΪʲôÎҵIJéѯºÜÂý£¿ÎªÊ²Ã´ÕâЩ²éѯûÓÐÀûÓÃË÷Òý£¿
+4.7)ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑùÆÀ¹À´¦ÀíÎҵIJéѯµÄ£¿
+4.8)ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽ²éÕÒ£¿ÔõÑùÀûÓÃË÷Òý½øÐдóСдÎ޹زéÕÒ£¿
+4.9)ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ NULL£¿ÎÒÈçºÎ²ÅÄÜ׼ȷÅÅÐò¶ø²»ÂÛij×Ö¶ÎÊÇ·ñº¬NULLÖµ£¿
+4.10)¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿
+4.11.1)ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿
+4.11.2)ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿
+4.11.3)ʹÓà currval() »áµ¼ÖºÍÆäËûÓû§µÄÎÉÂÒÇé¿ö£¨race condition£©Âð£¿
+4.11.4)Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖдæÔÚ¼ä¶ÏÄØ£¿
+4.12)ʲôÊÇ OID£¿Ê²Ã´ÊÇ CTID £¿
+4.13)ΪʲôÎÒÊÕµ½´íÎóÐÅÏ¢¡°ERROR: Memory exhausted in AllocSetAlloc()¡±£¿
+4.14)ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL µÄ°æ±¾£¿
+4.15)ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿
+4.16)ÈçºÎ½øÐÐ outer join £¨ÍâÁ¬½Ó£©£¿
+4.17)ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿
+4.18)ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿
+4.19)ΪʲôÎÒÔÚʹÓÃPL/PgSQLº¯Êý´æÈ¡ÁÙʱ±íʱ»áÊÕµ½´íÎóÐÅÏ¢¡°relation with OID ##### does not exist¡±£¿
+4.20)Ä¿Ç°ÓÐÄÄЩÊý¾Ý¸´ÖÆ·½°¸¿ÉÓã¿
+

+ +
+ +

³£¼ûÎÊÌâ

+ +

1.1)PostgreSQL ÊÇʲô£¿¸ÃÔõô·¢Òô£¿

+

+PostgreSQL ¶Á×÷ Post-Gres-Q-L£¬ÓÐʱºòÒ²¼ò³ÆΪPostgres ¡£ +

+

+ PostgreSQL ÊÇÃæÏòÄ¿±êµÄ¹ØϵÊý¾Ý¿âϵͳ£¬Ëü¾ßÓд«Í³ÉÌÒµÊý¾Ý¿âϵͳµÄËùÓй¦ÄÜ£¬Í¬Ê±ÓÖº¬Óн«ÔÚÏÂÒ»´ú DBMS ϵͳµÄʹÓõÄÔöÇ¿ÌØÐÔ¡£ + PostgreSQL ÊÇ×ÔÓÉÃâ·ÑµÄ£¬²¢ÇÒËùÓÐÔ´´úÂ붼¿ÉÒÔ»ñµÃ¡£ +

+ +

+ PostgreSQL µÄ¿ª·¢¶ÓÎéÖ÷ҪΪ־ԸÕߣ¬ËûÃDZ鲼ÊÀ½ç¸÷µØ²¢Í¨¹ý»¥ÁªÍø½øÐÐÁªÏµ£¬ÕâÊÇÒ»¸öÉçÇø¿ª·¢ÏîÄ¿£¬Ëü²»±»Èκι«Ë¾¿ØÖÆ¡£ + ÈçÏë¼ÓÈ뿪·¢¶ÓÎ飬Çë²Î¼û¿ª·¢ÈËÔ±³£¼ûÎÊÌ⣨FAQ£© + http://www.postgresql.org/files/documentation/faqs/FAQ_DEV.html +

+ + +

1.2)PostgreSQL µÄ°æȨÊÇʲô?

+

+PostgreSQLµÄ·¢²¼×ñ´Ó¾­µäµÄBSD°æȨ¡£¹ØÓÚÔ´´úÂëµÄÈçºÎʹÓÃûÓÐÈκÎÏÞÖÆ£¬ÎÒÃǺÜϲ»¶ÕâÖÖ·½Ê½²¢ÇÒ»¹Ã»ÓдòËã¸Ä±äËü¡£ +

+

+ÏÂÃæ¾ÍÊÇÎÒÃÇʹÓõÄBSD°æȨÄÚÈÝ£º +

+ +

+ ²¿·Ö°æȨ£¨c£©1996-2005£¬PostgreSQL È«Çò¿ª·¢Ð¡×飬²¿·Ö°æȨ£¨c£©1994-1996 ¼ÓÖÝ´óѧ¶­Ê +

+ +

+ £¨Portions copyright (c) 1996-2005, PostgreSQL Global Development Group Portions Copyright (c) 1994-6 Regents of the University of California£© +

+ +

+ ÔÊÐíΪÈκÎÄ¿µÄʹÓ㬿½±´£¬Ð޸ĺͷַ¢Õâ¸öÈí¼þºÍËüµÄÎĵµ¶ø²»ÊÕÈ¡ÈκηÑÓ㬠+ ²¢ÇÒÎÞÐëÇ©ÊðÒò´Ë¶ø²úÉúµÄÖ¤Ã÷£¬Ç°ÌáÊÇÉÏÃæµÄ°æȨÉùÃ÷ºÍ±¾¶ÎÒÔ¼°ÏÂÃæÁ½¶ÎÎÄ×Ö³öÏÖÔÚËùÓп½±´ÖС£ +

+ +

+ £¨Permission to use, copy, modify, and distribute this software and its + documentation for any purpose, without fee, and without a written agreement is + hereby granted, provided that the above copyright notice and this paragraph and + the following two paragraphs appear in all copies.£© +

+ +

+ ÔÚÈκÎÇé¿öÏ£¬¼ÓÖÝ´óѧ¶¼²»³Ðµ£ÒòʹÓôËÈí¼þ¼°ÆäÎĵµ¶øµ¼ÖµĶÔÈκε±ÊÂÈ˵ÄÖ±½ÓµÄ£¬ + ¼ä½ÓµÄ£¬ÌØÊâµÄ£¬¸½¼ÓµÄ»òÕßÏà°é¶øÉúµÄË𻵣¬°üÀ¨ÀûÒæËðʧµÄÔðÈΣ¬¼´Ê¹¼ÓÖÝ´óѧÒѾ­½¨ÒéÁËÕâЩËðʧµÄ¿ÉÄÜÐÔʱҲÊÇÈç´Ë¡£ +

+ +

+ £¨IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR + DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST + PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE.£© +

+ +

+ ¼ÓÖÝ´óѧÃ÷È··ÅÆúÈκα£Ö¤£¬°üÀ¨µ«²»¾ÖÏÞÓÚijһÌض¨ÓÃ;µÄÉÌÒµºÍÀûÒæµÄÒþº¬±£Ö¤¡£ + ÕâÀïÌṩµÄÕâ·ÝÈí¼þÊÇ»ùÓÚ¡°µ±×÷ÊÇ¡±µÄ»ù´¡µÄ£¬Òò¶ø¼ÓÖÝ´óѧûÓÐÔðÈÎÌṩά»¤£¬Ö§³Ö£¬¸üУ¬ÔöÇ¿»òÕßÐ޸ĵķþÎñ¡£ +

+ +

+ £¨THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND + THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, + SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.£©
+ +

+ +

1.3)PostgreSQL ¿ÉÒÔÔËÐÐÔÚÄÄЩ²Ù×÷ϵͳƽ̨ÉÏ£¿

+ +

+ Ò»°ã˵À´£¬Ò»¸öÏÖ´úµÄ UNIX ¼æÈݵÄƽ̨¶¼ÄÜÔËÐÐ PostgreSQL ¡£ÔÚ°²×°Ö¸ÄÏÀïÁгöÁË·¢²¼Ê±¾­¹ýÃ÷È·²âÊÔµÄƽ̨¡£ +

+ +

+ PostgreSQlÒ²¿ÉÒÔÖ±½ÓÔËÐÐÔÚ»ùÓÚ΢ÈíWindows-NTµÄ²Ù×÷ϵͳ£¬ÈçWin2000£¬WinXP ºÍ Win2003£¬ÒÑÖÆ×÷Íê³ÉµÄ°²×°°ü¿É´Ó + http://pgfoundry.org/projects/pginstallerÏÂÔØ£¬»ùÓÚMSDOSµÄWindows²Ù×÷ϵͳ + £¨Win95£¬Win98£¬WinMe£©ÐèҪͨ¹ýCygwinÄ£Äâ»·¾³ÔËÐÐPostgreSQL¡£ +

+ +

+ ͬʱҲÓÐÒ»¸öΪNovell Netware 6¿ª·¢µÄ°æ±¾¿É´Ó http://forge.novell.com »ñÈ¡£¬ÎªOS/2¿ª·¢µÄ°æ±¾¿É´Ó + + http://hobbes.nmsu.edu/cgi-bin/h-search?sh=1&button=Search&key=postgreSQL&stype=all&sort=type&dir=%2F +

+ +

1.4)ÎÒ´ÓÄÄÀïÄܵõ½ PostgreSQL£¿

+ +

+ ͨ¹ýä¯ÀÀÆ÷¿É´Óhttp://www.postgresql.org/ftp/ÏÂÔØ£¬Ò²¿Éͨ¹ýFTP£¬´Ó + ftp://ftp.PostgreSQL.org/pub/Õ¾µãÏÂÔØ¡£ +

+ + +

1.5)ÎÒ´ÓÄÄÀïÄܵõ½¶Ô PostgreSQL µÄÖ§³Ö£¿

+

+ PostgreSQLÉçÇøͨ¹ýÓʼþÁбíΪÆä´ó¶àÊýÓû§Ìṩ°ïÖú£¬¼ÓÈëÓʼþÁбíµÄÖ÷Õ¾µãÊÇ http://www.postgresql.org/community/lists/£¬Ò»°ãÇé¿öÏ£¬ÏȼÓÈëGeneral »ò BugÓʼþÁбíÊÇÒ»¸ö½ÏºÃµÄ¿ªÊ¼¡£ +

+ +

+ Ö÷ÒªµÄIRCƵµÀÊÇÔÚFreeNode(irc.freenode.net)µÄ#postgresql£¬ÎªÁËÁ¬ÉÏ´ËƵµÀ£¬¿ÉÒÔʹÓÃUNIX³ÌÐòirc£¬ÆäÖ¸Áî¸ñʽ£º + irc -c '#postgresql' "$USER" irc.freenode.net £¬»òÕßʹÓÃÆäËûIRC¿Í»§¶Ë³ÌÐò¡£ÔÚ´ËÍøÂçÖл¹´æÔÚÒ»¸öPostgreSQLµÄÎ÷°àÑÀƵµÀ(#postgersql-es)ºÍ·¨ÓïƵµÀ + (#postgresql-fr)¡£Í¬ÑùµØ£¬ÔÚEFNETÉÏÒ²ÓÐÒ»¸öPostgreSQLµÄ½»Á÷ƵµÀ¡£ +

+ +

+ ÉÌÒµÖ§³Ö¹«Ë¾µÄÁбíÔÚ http://techdocs.postgresql.org/companies.php¡£ +

+ + + +

1.6)ÎÒÈçºÎÌá½»Ò»¸öBUG±¨¸æ£¿

+

+ ¿É·ÃÎÊ http://www.postgresql.org/support/submitbug£¬ÌîдBugÉϱ¨±í¸ñ¼´¿É¡£ +

+ +

+ ͬÑùÒ²¿É·ÃÎÊftpÕ¾µãftp://ftp.PostgreSQL.org/pub/ ¼ì²éÓÐÎÞ¸üеÄPostgreSQL°æ±¾»ò²¹¶¡¡£ +

+ + + +

1.7)×îаæµÄPostgreSQL ÊÇʲô£¿

+

+ PostgreSQL ×îеİ汾ÊÇ°æ±¾ 8.0.2 £¨Òë×¢£ºÏÖ×îа汾Ϊ8.0.3£©¡£ +

+ +

+ ÎÒÃǼƻ®Ã¿Äê·¢²¼Ò»¸öÖ÷Òª°æ±¾£¬Ã¿¼¸¸öÔ·¢²¼Ò»¸öС°æ±¾¡£ +

+ + +

1.8)Äܹ»»ñÈ¡µÄ×îÐÂÎĵµÓÐÄÄЩ£¿

+ +

+ PostgreSQL°üº¬´óÁ¿µÄÎĵµ£¬Ö÷ÒªÓÐһЩÊֲᣬÊÖ²áÒ³ºÍһЩµÄ²âÊÔÀý×Ó¡£²Î¼û /doc Ŀ¼£¨Òë×¢£ºÓ¦Îª $PGHOME/doc£©¡£ + Ä㻹¿ÉÒÔÔÚÏßä¯ÀÀ PostgreSQL µÄÊֲᣬÆäµØÖ·ÊÇ£ºhttp://www.PostgreSQL.org/docs¡£ +

+

+ ÓÐÁ½±¾¹ØÓÚ PostgreSQL µÄÊéÔÚÏßÌṩ£¬ÔÚ + http://www.PostgreSQL.org/docs/awbook.html + ºÍ http://www.commandprompt.com/ppbook/ ¡£ + Ò²ÓдóÁ¿µÄPostgreSQLÊé¼®¿É¹©¹ºÂò£¬ÆäÖÐ×îΪÁ÷ÐеÄÒ»±¾ÊÇÓÉKorry Douglas±àдµÄ¡£ÔÚ + http://techdocs.PostgreSQL.org/techdocs/bookreviews.phpÉÏ + ÉÏÓдóÁ¿ÓйØPostgreSQLÊé¼®µÄ¼ò½é¡£ + ÔÚ http://techdocs.PostgreSQL.org/ÉÏÊÕ¼¯ÁËÓÐ¹Ø PostgreSQL µÄ´óÁ¿¼¼ÊõÎÄÕ¡£ +

+ +

+ ¿Í»§¶ËµÄÃüÁîÐгÌÐòpsqlÓÐһЩÒÔ \d ¿ªÍ·µÄÃüÁ¿ÉÏÔʾ¹ØÓÚÀàÐÍ£¬²Ù×÷·û£¬º¯Êý£¬»ã×ܵȵÄÐÅÏ¢£¬Ê¹Óà \? ¿ÉÒÔÏÔʾËùÓпÉÓõÄÃüÁî¡£ +

+ +

+ ÎÒÃÇµÄ web Õ¾µã°üº¬¸ü¶àµÄÎĵµ¡£ +

+ +

1.9)ÎÒÈçºÎÁ˽âÒÑÖªµÄ BUG »òÔÝȱµÄ¹¦ÄÜ£¿

+

+ PostgreSQL Ö§³ÖÒ»¸öÀ©Õ¹Á赀 SQL-92 µÄ×Ó¼¯¡£²ÎÔÄÎÒÃǵÄTODO ÁÐ±í£¬»ñÈ¡Ò»¸öÒÑÖªBug£¬ÔÝȱµÄ¹¦Äܺͽ«À´µÄ¼Æ»®¡£ +

+ + +

1.10)ÎÒÓ¦¸ÃÔõÑùѧϰ SQL £¿

+

+ Ê×ÏÈ¿¼ÂÇÉÏÊöÌáµ½µÄÓëPostgreSQLÏà¹ØµÄÊé¼®£¬ÁíÍâÒ»±¾ÊÇTeach Yourself SQL in 21 Days, Second Edition£¬ + ÎÒÃǵÄÐí¶àÓû§Ï²»¶The Practical SQL Handbook Bowman, Judith S., et al., Addison-Wesley£¬ÆäËûµÄÔòϲ»¶ + The Complete Reference SQL, Groff et al., McGraw-Hill¡£ +

+ + +

1.11)ÎÒÓ¦¸ÃÔõÑù¼ÓÈ뿪·¢¶ÓÎ飿

+

+ Ïê¼û Developer's FAQ ¡£ +

+ + +

1.12)PostgreSQL ºÍÆäËûÊý¾Ý¿âϵͳ±ÈÆðÀ´ÈçºÎ£¿

+

+ÆÀ¼ÛÈí¼þÓкü¸ÖÖ·½·¨£ºÌØÐÔ£¬ÐÔÄÜ£¬¿É¿¿ÐÔ£¬Ö§³ÖºÍ¼Û¸ñ¡£ +

+
+
ÌØÐÔ
+
+ PostgreSQL ÓµÓдóÐÍÉÌÓà DBMS Àï´ó¶àÊýÌØÐÔ£¬ + ÀýÈ磺ÊÂÎñ£¬×Ó²éѯ£¬´¥·¢Æ÷£¬ÊÓͼ£¬Íâ¼ü²Î¿¼ÍêÕûÐԺ͸´ÔÓµÄËøµÈ¡£ + ÎÒÃÇ»¹ÓÐһЩËüÃÇûÓеÄÌØÐÔ£¬ÈçÓû§¶¨ÒåÀàÐÍ£¬¼Ì³Ð£¬¹æÔòºÍ¶à°æ±¾²¢ÐпØÖÆÒÔ¼õÉÙËøµÄÕùÓõȡ£
+
+ +
ÐÔÄÜ
+
+ PostgreSQL ºÍÆäËûÉÌÓúͿªÔ´µÄÊý¾Ý¿â¾ßÓÐÀàËƵÄÐÔÄÜ¡£ + ¶ÔijЩ´¦ÀíËü±È½Ï¿ì£¬¶ÔÆäËûһЩ´¦ÀíËü±È½ÏÂý¡£ + ÓëÆäËûÊý¾Ý¿âÏà±È£¬ÎÒÃǵÄÐÔÄÜͨ³£ÔÚ +/- 10%Ö®¼ä¡£
+
+ +
¿É¿¿ÐÔ
+
+ ÎÒÃÇÖªµÀ DBMS ±ØÐëÊÇ¿É¿¿µÄ£¬·ñÔòËü¾ÍÒ»µãÓö¼Ã»ÓС£ + ÎÒÃÇŬÁ¦×öµ½·¢²¼¾­¹ýÈÏÕæ²âÊԵģ¬Îȶ¨µÄ³ô³æ×îÉٵĴúÂ롣ÿ¸ö°æ±¾ÖÁÉÙÓÐÒ»¸öÔ嵀 beta + ²âÊÔʱ¼ä£¬²¢ÇÒÎÒÃǵķ¢²¼ÀúÊ·ÏÔʾÎÒÃÇ¿ÉÒÔÌṩÎȶ¨µÄ£¬Àι̵ģ¬¿ÉÓÃÓÚÉú²úʹÓõİ汾¡£ÎÒÃÇÏàÐÅ + ÔÚÕâ·½ÃæÎÒÃÇÓëÆäËûµÄÊý¾Ý¿âÈí¼þÊÇÏ൱µÄ¡£
+
+ +
Ö§³Ö
+
+ ÎÒÃǵÄÓʼþÁбíÌṩһ¸ö·Ç³£´óµÄ¿ª·¢ÈËÔ±ºÍÓû§µÄ×éÒÔ°ïÖú½â¾öËùÅöµ½µÄÈκÎÎÊÌâ¡£ + ÎÒÃDz»Äܱ£Ö¤¿Ï¶¨Äܽâ¾öÎÊÌ⣬Ïà±È֮ϣ¬ÉÌÓà DBMS Ò²²¢²»ÊÇ×ÜÄܹ»Ìṩ½â¾ö·½·¨¡£ + Ö±½ÓÓ뿪·¢ÈËÔ±£¬Óû§Èº£¬ÊÖ²áºÍÔ´³ÌÐò½Ó´¥Áî PostgreSQL µÄÖ§³Ö±ÈÆäËû DBMS + »¹ÒªºÃ¡£»¹ÓÐһЩÉÌÒµÐÔµÄÔ¤°ü×°µÄÖ§³Ö£¬¿ÉÒÔ¸øÌṩ¸øÄÇЩÐèÒªµÄÈË¡££¨²ÎÔÄ FAQ Ìõ¿î 1.5 С½Ú£©
+
+ +
¼Û¸ñ
+
+ ÎÒÃǶÔÈκÎÓÃ;¶¼Ãâ·Ñ£¬°üÀ¨ÉÌÓúͷÇÉÌÓÃÄ¿µÄ¡£ + Äã¿ÉÒÔ²»¼ÓÏÞÖƵØÏòÄãµÄ²úÆ·Àï¼ÓÈëÎÒÃǵĴúÂ룬³ýÁËÄÇЩÎÒÃÇÔÚÉÏÃæµÄ°æȨÉùÃ÷ÀïÉùÃ÷µÄ BSD ·ç¸ñµÄ°æȨÍâ¡£ +
+ +
+ + +

1.13)Ë­¿ØÖÆPostgreSQL £¿

+

+ Èç¹ûÄãÔÚÑ°ÕÒPostgreSQLµÄÕÆÃÅÈË£¬»òÊÇʲôÖÐÑëίԱ»á£¬»òÊÇʲôËùÊô¹«Ë¾£¬ÄãÖ»ÄÜ·ÅÆúÁË---ÒòΪһ¸öÒ²²»´æÔÚ£¬µ«ÎÒÃǵÄÈ·ÓÐÒ»¸ö + ίԱ»áºÍCVS¹ÜÀí×飬µ«ÕâЩ¹¤×÷×éµÄÉèÁ¢Ö÷ÒªÊÇΪÁ˽øÐйÜÀí¹¤×÷¶ø²»ÊǶÔPostgreSQL½øÐпØÖÆ£¬PostgreSQLÏîÄ¿ÊÇÓÉÈκÎÈ˾ù + ¿É²Î¼ÓµÄ¿ª·¢ÈËÔ±ÉçÇøºÍËùÓÐÓû§¿ØÖƵģ¬ÄãËùÐèÒª×öµÄ¾ÍÊǼÓÈëÓʼþÁÐ±í£¬²ÎÓëÌÖÂÛ¼´¿É£¨Òª²ÎÓëPostgreSQLµÄ¿ª·¢Ïê¼û + Developer's FAQ »ñÈ¡ÐÅÏ¢£©¡£ +

+ +
+ + +

Óû§¿Í»§¶ËÎÊÌâ

+ +

2.1)ÎÒÃÇ¿ÉÒÔÓÃʲôÓïÑÔºÍ PostgreSQL ´ò½»µÀ£¿

+

+ PostgreSQL(ȱʡÇé¿ö)Ö»°²×°ÓÐCºÍÄÚǶʽCµÄ½Ó¿Ú£¬ÆäËûµÄ½Ó¿Ú¶¼ÊǶÀÁ¢µÄÏîÄ¿£¬Äܹ»·Ö±ðÏÂÔØ£¬ÕâЩ½Ó¿ÚÏîÄ¿¶ÀÁ¢µÄºÃ´¦ + ÊÇËûÃÇ¿ÉÒÔÓи÷×Եķ¢²¼¼Æ»®ºÍ¸÷×Ô¶ÀÁ¢µÄ¿ª·¢×é¡£ +

+

+ һЩ±à³ÌÓïÑÔÈçPHP¶¼ÓзÃÎÊ PostgreSQL µÄ½Ó¿Ú£¬Perl,TCL,PythonÒÔ¼°ºÜ¶àÆäËûÓïÑԵĽӿÚÔÚ + http://gborg.postgresql.org ÉϵÄDrivers/InterfacesС½Ú¿ÉÕÒµ½£¬ + ²¢ÇÒͨ¹ýInternetºÜÈÝÒ×ËÑË÷µ½¡£ +

+ + + +

2.2)ÓÐʲô¹¤¾ß¿ÉÒÔ°Ñ PostgreSQL ÓÃÓÚ Web Ò³Ã棿

+

+ Ò»¸ö½éÉÜÒÔÊý¾Ý¿âΪºǫ́µÄͦ²»´íµÄÕ¾µãÊÇ£ºhttp://www.webreview.com¡£ +

+

+ ¶ÔÓÚ Web ¼¯³É£¬PHP ÊÇÒ»¸ö¼«ºÃµÄ½Ó¿Ú¡£ËüÔÚ£ºhttp://www.php.net/¡£ +

+

+ ¶ÔÓÚ¸´ÔÓµÄÈÎÎñ£¬ºÜ¶àÈ˲ÉÓà Perl ½Ó¿ÚºÍ CGI.pm »ò mod_perl ¡£ +

+ + +

2.3)PostgreSQL ÓµÓÐͼÐÎÓû§½çÃæÂð£¿

+

+ Êǵģ¬ÔÚ http://techdocs.postgresql.org/guides/GUIToolsÓÐÒ»¸öÏêϸµÄÁÐ±í¡£ +

+ + + +
+ +

ϵͳ¹ÜÀíÎÊÌâ

+ +

3.1)ÎÒÔõÑùÄÜ°Ñ PostgreSQL ×°ÔÚ /usr/local/pgsql ÒÔÍâµÄµØ·½£¿

+

+ ÔÚÔËÐÐ configure ʱ¼ÓÉÏ --prefix Ñ¡Ïî¡£ +

+ + +

3.2)ÎÒÈçºÎ¿ØÖÆÀ´×ÔÆäËûÖ÷»úµÄÁ¬½Ó£¿

+

+ ȱʡʱ£¬PostgreSQL Ö»ÔÊÐíͨ¹ý unix ÓòÌ×½Ó×Ö»òTCP/IP·½Ê½ÇÒÀ´×Ô±¾»úµÄÁ¬½Ó¡£ + ÄãÖ»ÓÐÔÚÐÞ¸ÄÁËÅäÖÃÎļþpostgresql.confÖеÄlisten_addresses£¬ÇÒÒ²ÔÚÅäÖÃÎļþpg_hba.confÖдò¿ªÁË + Ö÷»úΪ»ù´¡£¨ host-based £©µÄÉí·ÝÈÏÖ¤£¬²¢ÖØÐÂÆô¶¯PostgreSQL£¬·ñÔòÆäËû»úÆ÷ÊDz»ÄÜÓëÄãµÄPostgreSQL·þÎñÆ÷Á¬½ÓµÄ¡£ +

+ + +

3.3)ÎÒÔõÑùµ÷ÕûÊý¾Ý¿âÒýÇæÒÔ»ñµÃ¸üºÃµÄÐÔÄÜ£¿

+

+ ÓÐÈý¸öÖ÷Òª·½Ãæ¿ÉÒÔÌáÉýPostgreSQLµÄDZÄÜ¡£ +

+ +
+
²éѯ·½Ê½µÄ±ä»¯
+
+ ÕâÖ÷ÒªÉæ¼°Ð޸IJéѯ·½Ê½ÒÔ»ñÈ¡¸üºÃµÄÐÔÄÜ: +
    +
  • ´´½¨Ë÷Òý£¬°üÀ¨±í´ïʽºÍ²¿·ÖË÷Òý£»
  • +
  • ʹÓÃCOPYÓï¾ä´úÌæ¶à¸öInsertÓï¾ä£»
  • +
  • ½«¶à¸öSQLÓï¾ä×é³ÉÒ»¸öÊÂÎñÒÔ¼õÉÙÌá½»ÊÂÎñµÄ¿ªÏú£»
  • +
  • ´ÓÒ»¸öË÷ÒýÖÐÌáÈ¡¶àÌõ¼Ç¼ʱʹÓÃCLUSTER£»
  • +
  • ´ÓÒ»¸ö²éѯ½á¹ûÖÐÈ¡³ö²¿·Ö¼Ç¼ʱʹÓÃLIMIT£»
  • +
  • ʹÓÃÔ¤±àÒëʽ²éѯ£¨Prepared Query)£»
  • +
  • ʹÓÃANALYZEÒÔ±£³Ö¾«È·µÄÓÅ»¯Í³¼Æ£»
  • +
  • ¶¨ÆÚʹÓà VACUUM »ò pg_autovacuum
  • +
  • ½øÐдóÁ¿Êý¾Ý¸ü¸ÄʱÏÈɾ³ýË÷Òý£¨È»ºóÖؽ¨Ë÷Òý£©
  • +
+
+ +
·þÎñÆ÷µÄÅäÖÃ
+
+ ÅäÖÃÎļþpostgres.confÖеĺܶàÉèÖö¼»áÓ°ÏìÐÔÄÜ£¬ËùÓвÎÊýµÄÁбí¿É¼û£º + Administration Guide/Server Run-time Environment/Run-time Configuration£¬ + ÓйزÎÊýµÄ½âÊͿɼû£º + http://www.varlena.com/varlena/GeneralBits/Tidbits/annotated_conf_e.html ºÍ + http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html¡£ +
+ +
Ó²¼þµÄÑ¡Ôñ
+
+ ¼ÆËã»úÓ²¼þ¶ÔÐÔÄܵÄÓ°Ïì¿Éä¯ÀÀ + http://candle.pha.pa.us/main/writings/pgsql/hw_performance/index.html ºÍ + http://www.powerpostgresql.com/PerfList/¡£ +
+ +
+ + +

3.4)PostgreSQL Àï¿ÉÒÔ»ñµÃʲôÑùµÄµ÷ÊÔÌØÐÔ£¿

+

+ PostgreSQL ÓкܶàÀàËÆ log_* µÄ·þÎñÆ÷ÅäÖñäÁ¿¿ÉÓÃÓÚ²éѯµÄ´òÓ¡ºÍ½ø³Ìͳ¼Æ£¬¶øÕâЩ¹¤×÷¶Ôµ÷ÊÔºÍÐÔÄܲâÊÔºÜÓаïÖú¡£ +

+ + + +

3.5)ΪʲôÔÚÊÔͼÁ¬½ÓʱÊÕµ½¡°Sorry, too many clients¡±ÏûÏ¢£¿

+

+ Õâ±íʾÄãÒѴﵽȱʡ100¸ö²¢·¢ºǫ́½ø³ÌÊýµÄÏÞÖÆ£¬ÄãÐèҪͨ¹ýÐÞ¸Äpostgresql.confÎļþÖеÄmax_connectionsÖµÀ´ + Ôö¼ÓpostmasterµÄºǫ́²¢·¢´¦ÀíÊý£¬Ð޸ĺóÐèÖØÐÂÆô¶¯postmaster¡£ +

+ + +

3.6)ΪʲôҪÔÚÉý¼¶ PostgreSQL Ö÷Òª·¢²¼°æ±¾Ê±×ö dump ºÍ restore £¿

+

+ PostgreSQL ¿ª·¢×é¶Ôÿ´ÎСµÄÉý¼¶½ö×öÁ˽ÏÉÙµÄÐ޸ģ¬Òò´Ë´Ó 7.4.0 Éý¼¶µ½ 7.4.1 ²»ÐèÒª dump ºÍ restore¡£ + µ«ÊÇÖ÷ÒªµÄÉý¼¶£¨ÀýÈç´Ó 7.3 µ½ 7.4£©Í¨³£»áÐÞ¸Äϵͳ±íºÍÊý¾Ý±íµÄÄÚ²¿¸ñʽ¡£ + ÕâЩ±ä»¯Ò»°ã±È½Ï¸´ÔÓ£¬Òò´ËÎÒÃDz»Î¬Êý¾ÝÎļþµÄÏòºó¼æÈÝ¡£ + dump ½«Êý¾Ý°´ÕÕͨÓõĸñʽÊä³ö£¬Ëæºó¿ÉÒÔ±»ÖØмÓÔز¢Ê¹ÓÃеÄÄÚ²¿¸ñʽ¡£ +

+ +

3.7)(ʹÓÃPostgreSQL)ÎÒÐèҪʹÓÃʲô¼ÆËã»úÓ²¼þ £¿

+

+ ÓÉÓÚ¼ÆËã»úÓ²¼þ´ó¶àÊýÊǼæÈݵģ¬ÈËÃÇ×ÜÊÇÇãÏòÓÚÏàÐÅËùÓмÆËã»úÓ²¼þÖÊÁ¿Ò²ÊÇÏàͬµÄ¡£ÊÂʵÉϲ»ÊÇ£¬ + ECC RAM£¨´øÆæżУÑéµÄÄڴ棩£¬SCSI £¨Ó²ÅÌ£©ºÍÓÅÖʵÄÖ÷°å±ÈһЩ±ãÒË»õÒª¸ü¼Ó¿É¿¿ÇÒ¾ßÓиüºÃµÄÐÔÄÜ¡£PostgreSQL¼¸ºõ¿ÉÒÔÔËÐÐÔÚÈκÎÓ²¼þÉÏ£¬ + µ«Èç¹û¿É¿¿ÐÔºÍÐÔÄܶÔÄãµÄϵͳºÜÖØÒª£¬Äã¾ÍÐèҪȫÃæµÄÑо¿Ò»ÏÂÄãµÄÓ²¼þÅäÖÃÁË¡£ÔÚÎÒÃǵÄÓʼþÁбíÉÏÒ²ÓйØÓÚ + Ó²¼þÅäÖúÍÐԼ۱ȵÄÌÖÂÛ¡£ +

+ + +
+ +

²Ù×÷ÎÊÌâ

+ + +

4.1)ÈçºÎֻѡÔñÒ»¸ö²éѯ½á¹ûµÄÍ·¼¸ÐУ¿»òÊÇËæ»úµÄÒ»ÐУ¿

+

+ Èç¹ûÄãÖ»ÊÇÒªÌáÈ¡¼¸ÐÐÊý¾Ý£¬²¢ÇÒÄãÔÚÖ´ÐвéѯÖÐÖªµÀÈ·ÇеÄÐÐÊý£¬Äã¿ÉÒÔʹÓÃLIMIT¹¦ÄÜ¡£ + Èç¹ûÓÐÒ»¸öË÷ÒýÓë ORDER BYÖеÄÌõ¼þÆ¥Å䣬PostgreSQL ¿ÉÄܾÍÖ»´¦ÀíÒªÇóµÄÍ·¼¸Ìõ¼Ç¼£¬ + £¨·ñÔò½«¶ÔÕû¸ö²éѯ½øÐд¦ÀíÖ±µ½Éú³ÉÐèÒªµÄÐУ©¡£Èç¹ûÔÚÖ´Ðвéѯ¹¦ÄÜʱ²»ÖªµÀÈ·ÇеļǼÊý£¬ + ¿ÉʹÓÃÓαê(cursor)ºÍFETCH¹¦ÄÜ¡£ +

+

+ ¿ÉʹÓÃÒÔÏ·½·¨ÌáÈ¡Ò»ÐÐËæ»ú¼Ç¼µÄ£º +

+
+		SELECT  cols
+		FROM tab
+		ORDER BY random()
+		LIMIT 1 ;
+
+ + + +

4.2)ÈçºÎ²é¿´±í¡¢Ë÷Òý¡¢Êý¾Ý¿âÒÔ¼°Óû§µÄ¶¨Ò壿ÈçºÎ²é¿´psqlÀïÓõ½µÄ²éѯָÁî²¢ÏÔʾËüÃÇ£¿

+

+ ÔÚpsqlÖÐʹÓà \dt ÃüÁîÀ´ÏÔʾÊý¾Ý±íµÄ¶¨Ò壬ҪÁ˽âpsqlÖеÄÍêÕûÃüÁîÁбí¿ÉʹÓÃ\? £¬ÁíÍ⣬ÄãÒ²¿ÉÒÔÔĶÁ psql µÄÔ´´úÂë + Îļþpgsql/src/bin/psql/describe.c£¬Ëü°üÀ¨ÎªÉú³Épsql·´Ð±¸ÜÃüÁîµÄÊä³öµÄËùÓÐ SQL ÃüÁî¡£Ä㻹¿ÉÒÔ´ø -E Ñ¡ÏîÆô¶¯ psql£¬ + ÕâÑùËü½«´òÓ¡³öÖ´ÐÐÄãÔÚpsqlÖÐËù¸ø³öµÄÃüÁîµÄÄÚ²¿Êµ¼ÊʹÓõÄSQL²éѯ¡£PostgreSQLÒ²ÌṩÁËÒ»¸ö¼æÈÝSQLµÄINFORMATION SCHEMA½Ó¿Ú£¬ + Äã¿ÉÒÔ´ÓÕâÀï»ñÈ¡¹ØÓÚÊý¾Ý¿âµÄÐÅÏ¢¡£ +

+

+ ÔÚϵͳÖÐÓÐһЩÒÔpg_ ´òÍ·µÄϵͳ±íÒ²ÃèÊöÁ˱íµÄ¶¨Òå¡£ +

+

+ ʹÓà psql -l Ö¸Áî¿ÉÒÔÁгöËùÓеÄÊý¾Ý¿â¡£ +

+

+ Ò²¿ÉÒÔä¯ÀÀһϠpgsql/src/tutorial/syscat.sourceÎļþ£¬ËüÁоÙÁ˺ܶà¿É´ÓÊý¾Ý¿âϵͳ±íÖлñÈ¡ÐÅÏ¢µÄSELECTÓï·¨¡£ +

+ + +

4.3)ÈçºÎ¸ü¸ÄÒ»¸ö×ֶεÄÊý¾ÝÀàÐÍ£¿

+

+ ÔÚ8.0°æ±¾Àï¸ü¸ÄÒ»¸ö×ֶεÄÊý¾ÝÀàÐͺÜÈÝÒ×£¬¿ÉʹÓà ALTER TABLE ALTER COLUMN TYPE ¡£ +

+

+ ÔÚÒÔÇ°µÄ°æ±¾ÖУ¬¿ÉÒÔÕâÑù×ö£º +

+
+	BEGIN;
+    ALTER TABLE tab ADD COLUMN new_col new_data_type;
+    UPDATE tab SET new_col = CAST(old_col AS new_data_type);
+    ALTER TABLE tab DROP COLUMN old_col;
+    COMMIT;
+
+

+ ÄãÈ»ºó¿ÉÒÔʹÓÃVACUUM FULL tab Ö¸ÁîÀ´Ê¹ÏµÍ³ÊÕ»ØÎÞЧÊý¾ÝËùÕ¼ÓõĿռ䡣 +

+ +

4.4)Ò»ÐмǼ£¬Ò»¸ö±í£¬Ò»¸ö¿âµÄ×î´ó³ß´çÊǶàÉÙ£¿

+

+ ÏÂÃæÊÇһЩÏÞÖÆ£º +

+
+
+ + + + + + + + + +
Ò»¸öÊý¾Ý¿â×î´ó³ß´ç£¿ÎÞÏÞÖÆ£¨ÒÑ´æÔÚÓÐ 32TB µÄÊý¾Ý¿â£©
Ò»¸ö±íµÄ×î´ó³ß´ç£¿32 TB
Ò»ÐмǼµÄ×î´ó³ß´ç£¿1.6 TB
Ò»¸ö×ֶεÄ×î´ó³ß´ç?1 GB
Ò»¸ö±íÀï×î´óÐÐÊý£¿ÎÞÏÞÖÆ
Ò»¸ö±íÀï×î´óÁÐÊý£¿250-1600 £¨ÓëÁÐÀàÐÍÓйأ©
Ò»¸ö±íÀïµÄ×î´óË÷ÒýÊýÁ¿£¿ÎÞÏÞÖÆ
+ + +

+ µ±È»£¬Êµ¼ÊÉÏûÓÐÕæÕýµÄÎÞÏÞÖÆ£¬»¹ÊÇÒªÊÜ¿ÉÓôÅÅ̿ռ䡢¿ÉÓÃÄÚ´æ/½»»»ÇøµÄÖÆÔ¼¡£ + ÊÂʵÉÏ£¬µ±ÕâЩÊýÖµ±äµÃÒì³£µØ´óʱ£¬ÏµÍ³ÐÔÄÜÒ²»áÊܴܺóÓ°Ïì¡£ +

+ +

+ ±íµÄ×î´ó³ß´ç 32 TB ²»ÐèÒª²Ù×÷ϵͳ¶Ô´óÎļþµÄÖ§³Ö¡£´ó±íÓöà¸ö 1 GB µÄÎļþ´æ´¢£¬Òò´ËÎļþϵͳ³ß´çµÄÏÞÖÆÊDz»ÖØÒªµÄ¡£ +

+

+ Èç¹ûȱʡµÄ¿é´óСÔö³¤µ½ 32K £¬×î´óµÄ±í³ß´çºÍ×î´óÁÐÊý»¹¿ÉÒÔÔö¼Óµ½Ëı¶¡£ +

+ + +

4.5)´æ´¢Ò»¸öµäÐ͵ÄÎı¾ÎļþÀïµÄÊý¾ÝÐèÒª¶àÉÙ´ÅÅ̿ռ䣿

+

+ Ò»¸ö Postgres Êý¾Ý¿â£¨´æ´¢Ò»¸öÎı¾Îļþ£©ËùÕ¼ÓõĿռä×î¶à¿ÉÄÜÐèÒªÏ൱ÓÚÕâ¸öÎı¾Îļþ×ÔÉí´óС5±¶µÄ´ÅÅ̿ռ䡣 +

+

+ ÀýÈ磬¼ÙÉèÓÐÒ»¸ö 100,000 ÐеÄÎļþ£¬Ã¿ÐÐÓÐÒ»¸öÕûÊýºÍÒ»¸öÎı¾ÃèÊö¡£ + ¼ÙÉèÎı¾´®µÄƽ¾ù³¤¶ÈΪ20×Ö½Ú¡£Îı¾ÎļþÕ¼Óà 2.8 MB¡£´æ·ÅÕâЩÊý¾ÝµÄ PostgreSQL Êý¾Ý¿âÎļþ´óÔ¼ÊÇ 6.4 MB: +

+
+     32 ×Ö½Ú: ÿÐеÄÍ·£¨¹À¼ÆÖµ£©
+     24 ×Ö½Ú: Ò»¸öÕûÊýÐÍ×ֶκÍÒ»¸öÎı¾ÐÍ×Ö¶Î
+   +  4 ×Ö½Ú: Ò³ÃæÄÚÖ¸ÏòÔª×éµÄÖ¸Õë
+   ----------------------------------------
+     60 ×Ö½ÚÿÐÐ
+
+   PostgreSQL Êý¾ÝÒ³µÄ´óСÊÇ 8192 ×Ö½Ú (8 KB)£¬Ôò£º
+
+   8192 ×Ö½Úÿҳ
+   -------------------   =  136 ÐÐ/Êý¾ÝÒ³£¨ÏòÏÂÈ¡Õû£©
+     60 ×Ö½ÚÿÐÐ
+
+   100000 Êý¾ÝÐÐ
+   --------------------  =  735 Êý¾ÝÒ³£¨ÏòÉÏÈ¡Õû£©
+      128 ÐÐÿҳ
+
+   735 Êý¾ÝÒ³ * 8192 ×Ö½Ú/Ò³  =  6,021,120 ×Ö½Ú£¨6 MB£©
+
+ +

+ Ë÷Òý²»ÐèÒªÕâô¶àµÄ¶îÍâÏûºÄ£¬µ«Ò²È·Êµ°üÀ¨±»Ë÷ÒýµÄÊý¾Ý£¬Òò´ËËüÃÇÒ²¿ÉÄÜºÜ´ó¡£ +

+

+ ¿ÕÖµNULL´æ·ÅÔÚλͼÖУ¬Òò´ËÕ¼ÓúÜÉٵĿռ䡣 +

+ +

4.6)ΪʲôÎҵIJéѯºÜÂý£¿ÎªÊ²Ã´ÕâЩ²éѯûÓÐÀûÓÃË÷Òý£¿

+

+ ²¢·Çÿ¸ö²éѯ¶¼»á×Ô¶¯Ê¹ÓÃË÷Òý¡£Ö»ÓÐÔÚ±íµÄ´óС³¬¹ýÒ»¸ö×îСֵ£¬²¢ÇÒ²éѯֻ»áÑ¡ÖбíÖнÏС±ÈÀýµÄ¼Ç¼ʱ²Å»á²ÉÓÃË÷Òý¡£ + ÕâÊÇÒòΪË÷ÒýɨÃèÒýÆðµÄËæ¼´´ÅÅÌ´æÈ¡¿ÉÄܱÈÖ±½ÓµØ¶ÁÈ¡±í£¨Ë³ÐòɨÃ裩¸üÂý¡£ +

+

+ ΪÁËÅжÏÊÇ·ñʹÓÃË÷Òý£¬PostgreSQL±ØÐë»ñµÃÓйرíµÄͳ¼ÆÖµ¡£ÕâЩͳ¼ÆÖµ¿ÉÒÔʹÓà VACUUM ANALYZE£¬»ò ANALYZE »ñµÃ¡£ + ʹÓÃͳ¼ÆÖµ£¬ÓÅ»¯Æ÷ÖªµÀ±íÖÐÓжàÉÙÐУ¬¾ÍÄܹ»¸üºÃµØÅжÏÊÇ·ñÀûÓÃË÷Òý¡£ + ͳ¼ÆÖµ¶ÔÈ·¶¨ÓÅ»¯µÄÁ¬½Ó˳ÐòºÍÁ¬½Ó·½·¨Ò²ºÜÓÐÓá£ÔÚ±íµÄÄÚÈÝ·¢Éú±ä»¯Ê±£¬Ó¦¶¨ÆÚ½øÐÐͳ¼ÆÖµµÄ¸üÐÂÊÕ¼¯¡£ +

+

+ Ë÷Òýͨ³£²»ÓÃÓÚ ORDER BY »òÖ´ÐÐÁ¬½Ó¡£¶ÔÒ»¸ö´ó±íµÄÒ»´Î˳ÐòɨÃ裬ÔÙ×öÒ»¸öÏÔʽµÄÅÅÐòͨ³£±ÈË÷ÒýɨÃèÒª¿ì¡£ +

+ +

+ µ«ÊÇ£¬ÔÚ LIMIT ºÍ ORDER BY ½áºÏʹÓÃʱ¾­³£»áʹÓÃË÷Òý£¬ÒòΪÕâÖ»»á·µ»Ø±íµÄһС²¿·Ö¡£ + ʵ¼ÊÉÏ£¬ËäÈ» MAX() ºÍ MIN() ²¢²»Ê¹ÓÃË÷Òý£¬Í¨¹ý¶Ô + ORDER BY ºÍ LLIMIT ʹÓÃË÷ÒýÈ¡µÃ×î´óÖµºÍ×îСֵҲÊÇ¿ÉÒԵģº +

+
+	SELECT col
+	FROM tab
+	ORDER BY col [ DESC ]
+	LIMIT 1;
+
+

+ Èç¹ûÄãÈ·ÐÅPostgreSQLµÄÓÅ»¯Æ÷ʹÓÃ˳ÐòɨÃèÊDz»ÕýÈ·µÄ£¬Äã¿ÉÒÔʹÓÃSET enable_seqscan TO 'off'Ö¸Á + È»ºóÔÙ´ÎÔËÐвéѯ£¬Äã¾Í¿ÉÒÔ¿´³öʹÓÃÒ»¸öË÷ÒýɨÃèÊÇ·ñȷʵҪ¿ìһЩ¡£ +

+ +

+ µ±Ê¹ÓÃͨÅä·û²Ù×÷£¬ÀýÈç LIKE »ò ~ ʱ£¬Ë÷ÒýÖ»ÄÜÔÚÌض¨µÄÇé¿öÏÂʹÓ㺠+

+ +

+ ÔÚ8.0֮ǰµÄ°æ±¾ÖУ¬³ý·ÇÒª²éѯµÄÊý¾ÝÀàÐͺÍË÷ÒýµÄÊý¾ÝÀàÐÍÏàÆ¥Å䣬·ñÔòË÷Òý¾­³£ÊÇδ±»Óõ½£¬ÌرðÊǶÔint2,int8ºÍÊýÖµÐ͵ÄË÷Òý¡£ +

+ +

4.7)ÎÒÈçºÎ²ÅÄÜ¿´µ½²éѯÓÅ»¯Æ÷ÊÇÔõÑùÆÀ¹À´¦ÀíÎҵIJéѯ£¿

+

+ ²Î¿¼ EXPLAIN ÊÖ²áÒ³¡£ +

+ +

4.8)ÎÒÔõÑù×öÕýÔò±í´ïʽËÑË÷ºÍ´óСдÎ޹صÄÕýÔò±í´ïʽ²éÕÒ£¿ÔõÑùÀûÓÃË÷Òý½øÐдóСдÎ޹زéÕÒ£¿

+

+ ²Ù×÷·û ~ ´¦ÀíÕýÔò±í´ïʽƥÅ䣬¶ø ~* ´¦Àí´óСдÎ޹صÄÕýÔò±í´ïʽƥÅä¡£´óдЩÎÞ¹ØµÄ LIKE ±äÖÖ³ÉΪ ILIKE¡£ +

+

+ ´óСдÎ޹صĵÈʽ±È½Ïͨ³£Ð´×ö£º +

+
    SELECT *
+    FROM tab
+    WHERE lower(col) = 'abc';
+
+

+ ÕâÑù½«²»»áʹÓñê×¼µÄË÷Òý¡£µ«ÊÇ¿ÉÒÔ´´½¨Ò»¸ö¿É±»ÀûÓõĺ¯ÊýË÷Òý: +

+
    CREATE INDEX tabindex ON tab (lower(col));
+
+ +

4.9)ÔÚÒ»¸ö²éѯÀÎÒÔõÑù¼ì²âÒ»¸ö×Ö¶ÎÊÇ·ñΪ NULL £¿ÎÒÈçºÎ²ÅÄÜ׼ȷÅÅÐò¶ø²»ÂÛij×Ö¶ÎÊÇ·ñº¬ NULL Öµ£¿

+

+ Óà IS NULL ºÍ IS NOT NULL ²âÊÔÕâ¸ö×ֶΣ¬¾ßÌå·½·¨ÈçÏ£º +

+
   SELECT *
+   FROM tab
+   WHERE col IS NULL;
+
+ +

ΪÁËÄܶԺ¬ NULL×Ö¶ÎÅÅÐò£¬¿ÉÔÚ ORDER BY Ìõ¼þÖÐʹÓà IS NULLºÍ + IS NOT NULL ÐÞÊηû£¬Ìõ¼þΪÕæ true ½«±ÈÌõ¼þΪ¼Ùfalse ÅÅÔÚÇ°Ã棬ÏÂÃæµÄÀý×ӾͻὫº¬ + NULL µÄ¼Ç¼ÅÅÔÚ½á¹ûµÄÉÏÃ沿·Ö£º +

+
   SELECT *
+   FROM tab
+   ORDER BY (col IS NOT NULL)
+
+ +

4.10)¸÷ÖÖ×Ö·ûÀàÐÍÖ®¼äÓÐʲô²»Í¬£¿

+
+ + + + + + + + + +
ÀàÐÍÄÚ²¿Ãû³Æ˵Ã÷
VARCHAR(n)varcharÖ¸¶¨ÁË×î´ó³¤¶È£¬±ä³¤×Ö·û´®£¬²»×㶨Ò峤¶ÈµÄ²¿·Ö²»²¹Æë
CHAR(n)bpchar¶¨³¤×Ö·û´®£¬Êµ¼ÊÊý¾Ý²»×㶨Ò峤¶Èʱ£¬ÒÔ¿Õ¸ñ²¹Æë
TEXTtextûÓÐÌرðµÄÉÏÏÞÏÞÖÆ£¨½öÊÜÐеÄ×î´ó³¤¶ÈÏÞÖÆ£©
BYTEAbytea±ä³¤×Ö½ÚÐòÁУ¨Ê¹ÓÃNULLÒ²ÊÇÔÊÐíµÄ£©
"char"charÒ»¸ö×Ö·û
+
+ +

+ ÔÚϵͳ±íºÍÔÚһЩ´íÎóÐÅÏ¢ÀïÄ㽫¿´µ½ÄÚ²¿Ãû³Æ¡£ +

+

+ ÉÏÃæËùÁеÄÇ°ËÄÖÖÀàÐÍÊÇ"varlena"£¨±ä³¤£©ÀàÐÍ£¨Ò²¾ÍÊÇ˵£¬¿ªÍ·µÄËĸö×Ö½ÚÊdz¤¶È£¬ºóÃæ²ÅÊÇÊý¾Ý£©¡£ + ÓÚÊÇʵ¼ÊÕ¼ÓõĿռä±ÈÉùÃ÷µÄ´óСҪ¶àһЩ¡£ + È»¶øÕâЩÀàÐͶ¼¿ÉÒÔ±»Ñ¹Ëõ´æ´¢£¬Ò²¿ÉÒÔÓà TOAST ÍÑ»ú´æ´¢£¬Òò´Ë´ÅÅÌ¿Õ¼äÒ²¿ÉÄܱÈÔ¤ÏëµÄÒªÉÙ¡£ +

+

+ VARCHAR(n) ÔÚ´æ´¢ÏÞÖÆÁË×î´ó³¤¶ÈµÄ±ä³¤×Ö·û´®ÊÇ×îºÃµÄ¡£ + TEXT ÊÊÓÃÓÚ´æ´¢×î´ó¿É´ï 1G×óÓÒµ«Î´¶¨ÒåÏÞÖƳ¤¶ÈµÄ×Ö·û´®¡£ +

+

+ CHAR(n) ×îÊʺÏÓÚ´æ´¢³¤¶ÈÏàͬµÄ×Ö·û´®¡£ CHAR(n)»á¸ù¾ÝËù¸ø¶¨µÄ×ֶ㤶ÈÒÔ¿Õ¸ñ²¹×㣨²»×ãµÄ×Ö¶ÎÄÚÈÝ£©£¬ + ¶ø VARCHAR(n) Ö»´æ´¢Ëù¸ø¶¨µÄÊý¾ÝÄÚÈÝ¡£ + BYTEA ÓÃÓÚ´æ´¢¶þ½øÖÆÊý¾Ý£¬ÓÈÆäÊÇ°üº¬ NULL ×Ö½ÚµÄÖµ¡£ÕâЩÀàÐ;ßÓÐÏàËƵÄÐÔÄÜÌØÐÔ¡£ +

+ + + +

4.11.1)ÎÒÔõÑù´´½¨Ò»¸öÐòÁкÅ/×Ô¶¯µÝÔöµÄ×ֶΣ¿

+

+ PostgreSQL Ö§³Ö SERIAL Êý¾ÝÀàÐÍ¡£ËüÔÚ×Ö¶ÎÉÏ×Ô¶¯´´½¨Ò»¸öÐòÁкÍË÷Òý¡£ÀýÈ磺 +

+
+	CREATE TABLE person ( 
+		id   SERIAL, 
+		name TEXT 
+	);
+
+

+ »á×Ô¶¯×ª»»Îª£º +

+
+	CREATE SEQUENCE person_id_seq;
+	CREATE TABLE person ( 
+		id   INT4 NOT NULL DEFAULT nextval('person_id_seq'),
+		name TEXT
+	);
+
+

+ ²Î¿¼ create_sequence ÊÖ²áÒ³»ñÈ¡¹ØÓÚÐòÁеĸü¶àÐÅÏ¢¡£ +

+ + +

4.11.2)ÎÒÈçºÎ»ñµÃÒ»¸ö²åÈëµÄÐòÁкŵÄÖµ£¿

+

+ Ò»ÖÖ·½·¨ÊÇÔÚ²åÈë֮ǰÏÈÓú¯Êý nextval() ´ÓÐòÁжÔÏóÀï¼ìË÷³öÏÂÒ»¸ö SERIAL Öµ£¬È»ºóÔÙÏÔʽ²åÈ롣ʹÓà + 4.11.1 ÀïµÄÀý±í£¬¿ÉÓÃαÂëÕâÑùÃèÊö£º +

+
+	new_id = execute("SELECT nextval('person_id_seq')");
+	execute("INSERT INTO person (id, name) VALUES (new_id, 'Blaise Pascal')");
+
+

+ ÕâÑù»¹ÄÜÔÚÆäËû²éѯÖÐʹÓôæ·ÅÔÚ new_id ÀïµÄÐÂÖµ£¨ÀýÈ磬×÷Ϊ person ±íµÄÍâ¼ü£©¡£ + ×¢Òâ×Ô¶¯´´½¨µÄ SEQUENCE ¶ÔÏóµÄÃû³Æ½«»áÊÇ <table>_<serialcolumn>_seq£¬ + ÕâÀï table ºÍ serialcolumn ·Ö±ðÊÇÄãµÄ±íµÄÃû³ÆºÍÄãµÄ SERIAL ×ֶεÄÃû³Æ¡£ +

+

+ ÀàËƵģ¬ÔÚ SERIAL ¶ÔÏóȱʡ²åÈëºóÄã¿ÉÒÔÓú¯Êý currval() ¼ìË÷¸Õ¸³ÖµµÄ SERIAL Öµ£¬ÀýÈ磺 +

+
+	execute("INSERT INTO person (name) VALUES ('Blaise Pascal')");
+	new_id = execute("SELECT currval('person_id_seq')");
+
+ +

4.11.3)ʹÓà currval() »áµ¼ÖºÍÆäËûÓû§µÄ³åÍ»Çé¿ö£¨race condition£©Âð£¿

+

+ ²»»á¡£currval() ·µ»ØµÄÊÇÄã±¾´Î»á»°½ø³ÌËù¸³µÄÖµ¶ø²»ÊÇËùÓÐÓû§µÄµ±Ç°Öµ¡£
+

+ +

4.11.4)Ϊʲô²»ÔÚÊÂÎñÒì³£ÖÐÖ¹ºóÖØÓÃÐòÁкÅÄØ£¿ÎªÊ²Ã´ÔÚÐòÁкÅ×ֶεÄÈ¡ÖµÖдæÔÚ¼ä¶ÏÄØ£¿

+

+ ΪÁËÌá¸ß²¢·¢ÐÔ£¬ÐòÁкÅÔÚÐèÒªµÄʱºò¸³ÓèÕýÔÚÔËÐеÄÊÂÎñ£¬²¢ÇÒÔÚÊÂÎñ½áÊø֮ǰ²»½øÐÐËø¶¨£¬ + Õâ¾Í»áµ¼ÖÂÒì³£ÖÐÖ¹µÄÊÂÎñºó£¬ÐòÁкŻá³öÏÖ¼ä¸ô¡£ +

+ +


4.12)ʲôÊÇ OID £¿Ê²Ã´ÊÇ CTID £¿

+

+ PostgreSQL Àï´´½¨µÄÿһÐмǼ¶¼»á»ñµÃÒ»¸öΨһµÄOID£¬³ý·ÇÔÚ´´½¨±íʱʹÓÃWITHOUT OIDSÑ¡Ïî¡£ + OID´´½¨Ê±»á×Ô¶¯Éú³ÉÒ»¸ö4×Ö½ÚµÄÕûÊý£¬ËùÓÐ OID ÔÚÕû¸ö PostgreSQL ÖоùÊÇΨһµÄ¡£ È»¶ø£¬ËüÔÚ³¬¹ý40ÒÚʱ½«Òç³ö£¬ + OID´Ëºó»á³öÏÖÖظ´¡£PostgreSQL ÔÚËüµÄÄÚ²¿ÏµÍ³±íÀïʹÓà OID ÔÚ±íÖ®¼ä½¨Á¢ÁªÏµ¡£ +

+

+ ÔÚÓû§µÄÊý¾Ý±íÖУ¬×îºÃÊÇʹÓÃSERIAlÀ´´úÌæOID + ÒòΪSERIALÖ»ÊDZ£Ö¤ÔÚµ¥¸ö±íÖÐÊý¾ÝÊÇΨһµÄ£¬ÕâÑùËüÒç³öµÄ¿ÉÄÜÐԾͷdz£Ð¡ÁË£¬ + SERIAL8¿ÉÓÃÀ´±£´æ8×Ö½ÚµÄÐòÁкÅ×ֶΡ£ +

+ +

+ CTID ÓÃÓÚ±êʶ´ø×ÅÊý¾Ý¿é£¨µØÖ·£©ºÍ£¨¿éÄÚ£©Æ«ÒƵÄÌض¨µÄÎïÀíÐС£ + CTID ÔڼǼ±»¸ü¸Ä»òÖØÔغó·¢Éú¸Ä±ä¡£Ë÷ÒýÈë¿ÚʹÓÃËüÃÇÖ¸ÏòÎïÀíÐС£ +

+ + +

4.13)ΪʲôÎÒÊÕµ½´íÎóÐÅÏ¢¡°ERROR: Memory exhausted in AllocSetAlloc()¡±£¿

+

+ ÕâºÜ¿ÉÄÜÊÇϵͳµÄÐéÄâÄÚ´æÓùâÁË£¬»òÕßÄں˶ÔijЩ×ÊÔ´Óнϵ͵ÄÏÞÖÆÖµ¡£ÔÚÆô¶¯ postmaster ֮ǰÊÔÊÔÏÂÃæµÄÃüÁ +

+
+	ulimit -d 262144
+	limit datasize 256m
+
+

+ È¡¾öÓÚÄãÓÃµÄ shell£¬ÉÏÃæÃüÁîÖ»ÓÐÒ»ÌõÄܳɹ¦£¬µ«ÊÇËü½«°ÑÄãµÄ½ø³ÌÊý¾Ý¶ÎÏÞÖÆÉèµÃ±È½Ï¸ß£¬ + Òò¶øÒ²ÐíÄÜÈòéѯÍê³É¡£ÕâÌõÃüÁîÓ¦ÓÃÓÚµ±Ç°½ø³Ì£¬ÒÔ¼°ËùÓÐÔÚÕâÌõÃüÁîÔËÐк󴴽¨µÄ×Ó½ø³Ì¡£ + Èç¹ûÄãÊÇÔÚÔËÐÐSQL¿Í»§¶ËʱÒòΪºǫ́·µ»ØÁËÌ«¶àµÄÊý¾Ý¶ø³öÏÖÎÊÌ⣬ÇëÔÚÔËÐпͻ§¶Ë֮ǰִÐÐÉÏÊöÃüÁî¡£ +

+ +

4.14)ÎÒÈçºÎ²ÅÄÜÖªµÀËùÔËÐÐµÄ PostgreSQL µÄ°æ±¾£¿

+

+ ´Ó psql ÀÊäÈë SELECT version();Ö¸Áî¡£ +

+ +

4.15)ÎÒÈçºÎ´´½¨Ò»¸öȱʡֵÊǵ±Ç°Ê±¼äµÄ×ֶΣ¿

+

+ ʹÓà CURRENT_TIMESTAMP£º +

+
+	CREATE TABLE test (x int, modtime TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
+
+ + +

4.16)ÎÒÔõÑù½øÐÐ outer join £¨ÍâÁ¬½Ó£©£¿

+

+ PostgreSQL ²ÉÓñê×¼µÄ SQL Óï·¨Ö§³ÖÍâÁ¬½Ó¡£ÕâÀïÊÇÁ½¸öÀý×Ó£º +

+
+	SELECT *
+	FROM t1 LEFT OUTER JOIN t2 ON (t1.col = t2.col);
+
+

»òÊÇ

+
+	SELECT *
+	FROM t1 LEFT OUTER JOIN t2 USING (col);
+
+

+ ÕâÁ½¸öµÈ¼ÛµÄ²éѯÔÚ t1.col ºÍ t2.col ÉÏ×öÁ¬½Ó£¬²¢ÇÒ·µ»Ø t1 ÖÐËùÓÐδÁ¬½ÓµÄÐУ¨ÄÇЩÔÚ t2 ÖÐûÓÐÆ¥ÅäµÄÐУ©¡£ + ÓÒ[Íâ]Á¬½Ó(RIGHT OUTER JOIN)½«·µ»Ø t2 ÖÐδÁ¬½ÓµÄÐС£ + ÍêÈ«ÍâÁ¬½Ó£¨FULL OUTER JOIN£©½«·µ»Ø t1 ºÍ t2 ÖÐδÁ¬½ÓµÄÐС£ + ¹Ø¼ü×Ö OUTER ÔÚ×ó[Íâ]Á¬½Ó¡¢ÓÒ[Íâ]Á¬½ÓºÍÍêÈ«[Íâ]Á¬½ÓÖÐÊÇ¿ÉÑ¡µÄ£¬ÆÕͨÁ¬½Ó±»³ÆΪÄÚÁ¬½Ó£¨INNER JOIN£©¡£ +

+ + +

4.17)ÈçºÎʹÓÃÉæ¼°¶à¸öÊý¾Ý¿âµÄ²éѯ£¿

+

+ ûÓа취²éѯµ±Ç°Êý¾Ý¿âÖ®ÍâµÄÊý¾Ý¿â¡£ + ÒòΪ PostgreSQL Òª¼ÓÔØÓëÊý¾Ý¿âÏà¹ØµÄϵͳĿ¼£¨ÏµÍ³±í£©£¬Òò´Ë¿çÊý¾Ý¿âµÄ²éѯÈçºÎÖ´ÐÐÊDz»¶¨µÄ¡£ +

+

+ ¸½¼ÓÔöֵģ¿écontrib/dblinkÔÊÐí²ÉÓú¯Êýµ÷ÓÃʵÏÖ¿ç¿â²éѯ¡£µ±È»Óû§Ò²¿ÉÒÔͬʱÁ¬½Óµ½²»Í¬µÄÊý¾Ý¿âÖ´ÐвéѯȻºóÔÚ¿Í»§¶ËºÏ²¢½á¹û¡£ +

+ +

4.18)ÈçºÎÈú¯Êý·µ»Ø¶àÐлò¶àÁУ¿

+

+ ÔÚº¯ÊýÖзµ»ØÊý¾Ý¼Ç¼¼¯µÄ¹¦ÄÜÊǺÜÈÝÒ×ʹÓõģ¬ÏêÇé²Î¼û£º + http://techdocs.postgresql.org/guides/SetReturningFunctions +

+ +

4.19)ΪʲôÎÒÔÚʹÓÃPL/PgSQLº¯Êý´æÈ¡ÁÙʱ±íʱ»áÊÕµ½´íÎóÐÅÏ¢¡°relation with OID ##### does not exist¡±£¿

+

+ PL/PgSQL»á»º´æº¯ÊýµÄÄÚÈÝ£¬ÓÉ´Ë´øÀ´µÄÒ»¸ö²»ºÃµÄ¸±×÷ÓÃÊÇÈôÒ»¸ö PL/PgSQL + º¯Êý·ÃÎÊÁËÒ»¸öÁÙʱ±í£¬È»ºó¸Ã±í±»É¾³ý²¢Öؽ¨ÁË£¬ÔòÔٴε÷Óøú¯Êý½«Ê§°Ü£¬ + ÒòΪ»º´æµÄº¯ÊýÄÚÈÝÈÔȻָÏò¾ÉµÄÁÙʱ±í¡£½â¾öµÄ·½·¨ÊÇÔÚ PL/PgSQL ÖÐÓÃEXECUTE + ¶ÔÁÙʱ±í½øÐзÃÎÊ¡£ÕâÑù»á±£Ö¤²éѯÔÚÖ´ÐÐÇ°×ܻᱻÖØнâÎö¡£ +

+ +

4.27)Ä¿Ç°ÓÐÄÄЩÊý¾Ý¸´ÖÆ·½°¸¿ÉÓã¿

+

+ ¡°¸´ÖÆ¡±Ö»ÊÇÒ»¸öÊõÓÓкü¸ÖÖ¸´ÖƼ¼Êõ¿ÉʹÓã¬Ã¿ÖÖ¶¼ÓÐÓŵãºÍȱµã£º +

+

+ Ö÷/´Ó¸´ÖÆ·½Ê½ÊÇÔÊÐíÒ»¸öÖ÷·þÎñÆ÷½ÓÊܶÁ/дµÄÉêÇ룬¶ø¶à¸ö´Ó·þÎñÆ÷Ö»ÄܽÓÊܶÁ/SELECT²éѯµÄÉêÇ룬 + Ä¿Ç°×îÁ÷ÐÐÇÒÊÇÃâ·ÑµÄÖ÷/´Ó PostgreSQL¸´ÖÆ·½°¸ÊÇ + Slony-I ¡£ +

+

+ ¶à¸öÖ÷·þÎñÆ÷µÄ¸´ÖÆ·½Ê½ÔÊÐí½«¶Á/дµÄÉêÇë·¢Ë͸ø¶ą̀µÄ¼ÆËã»ú£¬ÕâÖÖ·½Ê½ÓÉÓÚÐèÒªÔÚ¶ą̀·þÎñÆ÷Ö®¼äͬ²½Êý¾Ý±ä¶¯ + ¿ÉÄÜ»á´øÀ´½ÏÑÏÖصÄÐÔÄÜËðʧ£¬PgclusterÊÇÄ¿Ç°ÕâÖÖ·½°¸ + ÖÐ×îºÃµÄ£¬¶øÇÒ»¹¿ÉÒÔÃâ·ÑÏÂÔØ¡£ +

+

+ Ò²ÓÐһЩÉÌÒµÐ踶·ÑºÍ»ùÓÚÓ²¼þµÄÊý¾Ý¸´ÖÆ·½°¸£¬Ö§³ÖÉÏÊö¸÷ÖÖ¸´ÖÆÄ£ÐÍ¡£ +

+ + + + + + -- 2.40.0