¾¤Î¥Ð¡¼¥¸¥ç¥ó¤Îʸ½ñ ¡§ 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9.6 | 9.5 | 9.4 | 9.3 | 9.2 | 9.1 | 9.0 | 8.4 | 8.3 | 8.2 | 8.1 | 8.0 | 7.4 | 7.3 | 7.2

Âè 13¾ÏÀ­Ç½¤Ë´Ø¤¹¤ë¥Ò¥ó¥È

Ìܼ¡
13.1. EXPLAIN¤ÎÍøÍÑ
13.2. ¥×¥é¥ó¥Ê¤Ç»ÈÍѤµ¤ì¤ëÅý·×¾ðÊó
13.3. ÌÀ¼¨Åª¤ÊJOIN¶ç¤Ç¥×¥é¥ó¥Ê¤òÀ©¸æ¤¹¤ë
13.4. ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥Ç¡¼¥¿ÅêÆþ
13.4.1. ¼«Æ°¥³¥ß¥Ã¥È¤ò¥ª¥Õ¤Ë¤¹¤ë
13.4.2. COPY¤Î»ÈÍÑ
13.4.3. ¥¤¥ó¥Ç¥Ã¥¯¥¹¤òºï½ü¤¹¤ë
13.4.4. ³°Éô¥­¡¼À©Ìó¤Îºï½ü
13.4.5. maintenance_work_mem¤òÁý¤ä¤¹
13.4.6. checkpoint_segments¤òÁý¤ä¤¹
13.4.7. ºÇ¸å¤ËANALYZE¤ò¼Â¹Ô
13.4.8. pg_dump¤Ë´Ø¤¹¤ë¤¤¤¯¤Ä¤«¤ÎÃí°Õ

Ì䤤¹ç¤ï¤»¤ÎÀ­Ç½¤Ï¿¤¯¤ÎÍ×°ø¤Ë±Æ¶Á¤µ¤ì¤Þ¤¹¡£ ¥æ¡¼¥¶¤¬À©¸æ¤Ç¤­¤ë¤â¤Î¤â¤¢¤ê¤Þ¤¹¤¬¡¢Çظå¤Ë¤¢¤ë¥·¥¹¥Æ¥àÀ߷פ˵¯°ø¤¹¤ëº¬ËÜŪ¤ÊÍ×°ø¤â¤¢¤ê¤Þ¤¹¡£ ËܾϤǤÏPostgreSQL¤ÎÀ­Ç½¤òÍý²ò¤·¡¢¥Á¥å¡¼¥Ë¥ó¥°¤¹¤ë¤¿¤á¤Î¥Ò¥ó¥È¤òÄ󶡤·¤Þ¤¹¡£

13.1. EXPLAIN¤ÎÍøÍÑ

PostgreSQL¤ÏÍ¿¤¨¤é¤ì¤¿Ì䤤¹ç¤ï¤»¤«¤éÌ䤤¹ç¤ï¤»·×²è¤òºî¤ê½Ð¤·¤Þ¤¹¡£ Ì䤤¹ç¤ï¤»¤Î¹½Â¤¤È´Þ¤Þ¤ì¤ë¥Ç¡¼¥¿¤ÎÀ­¼Á¤ËŬ¤·¤¿Àµ¤·¤¤Ì䤤¹ç¤ï¤»·×²è¤òÁªÂò¤¹¤ë¤³¤È¤¬Îɤ¤À­Ç½¤òÆÀ¤ë¤¿¤á¤ËÈó¾ï¤Ë½ÅÍפˤʤê¤Þ¤¹¡£ ¤Ç¤¹¤Î¤Ç¡¢Í¥¤ì¤¿·×²è¤ÎÁªÂò¤ò»î¤ß¤ë¥·¥¹¥Æ¥à¤Ë¤ÏÊ£»¨¤Ê¥×¥é¥ó¥Ê¤¬Â¸ºß¤·¤Þ¤¹¡£ EXPLAIN¥³¥Þ¥ó¥É¤ò»È¤¨¤Ð¡¢Ç¤°Õ¤ÎÌ䤤¹ç¤ï¤»¤ËÂФ·¤Æ¥×¥é¥ó¥Ê¤¬¤É¤Î¤è¤¦¤ÊÌ䤤¹ç¤ï¤»·×²è¤òºî¤Ã¤¿¤Î¤«¤ï¤«¤ê¤Þ¤¹¡£ Ì䤤¹ç¤ï¤»·×²è¤òÆɤߤ³¤Ê¤¹¤³¤È¤Ë¤Ä¤¤¤Æ¤Ï¡¢ÊÌÅÓ¹­ÈϰϤˤ錄¤ë¥Á¥å¡¼¥È¥ê¥¢¥ë¤òºî¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Û¤É¤ÎÏÓ¤¬É¬ÍפǤ¹¡£ Ëܽñ¤Ç¤Ï¤½¤³¤Þ¤Ç¥«¥Ð¡¼¤·¤Þ¤»¤ó¤¬¡¢´ðËÜŪ¤Ê¾ðÊó¤ò¤¤¤¯¤Ä¤«Ä󶡤·¤Þ¤¹¡£

Ì䤤¹ç¤ï¤»·×²è¤Ï¡¢·×²è¥Î¡¼¥É¤Î¥Ä¥ê¡¼¹½Â¤¤Ç¤¹¡£ ºÇ²¼ÁإΡ¼¥É¤Ï¥Æ¡¼¥Ö¥ë¥¹¥­¥ã¥ó¥Î¡¼¥É¤Ç¡¢¥Æ¡¼¥Ö¥ë¤«¤é¹Ô¤½¤Î¤â¤Î¤òÊÖ¤·¤Þ¤¹¡£ ¥·¡¼¥±¥ó¥·¥ã¥ë¥¹¥­¥ã¥ó¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¥¹¥­¥ã¥ó¡¢¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥ó¥Ç¥Ã¥¯¥¹¥¹¥­¥ã¥ó¤È¤¤¤Ã¤¿¥Æ¡¼¥Ö¥ë¥¢¥¯¥»¥¹ÊýË¡¤Î°ã¤¤¤Ë±þ¤¸¡¢¥¹¥­¥ã¥ó¥Î¡¼¥É¤Î¼ïÎà¤Ë°ã¤¤¤¬¤¢¤ê¤Þ¤¹¡£ Ì䤤¹ç¤ï¤»¤¬·ë¹ç¡¢½¸Ìó¡¢¥½¡¼¥È¡¢¤½¤Î¾¹Ô¤½¤Î¤â¤Î¤ËÂФ¹¤ëÁàºî¤òɬÍפȤ·¤Æ¤¤¤ë¾ì¹ç¡¢¥¹¥­¥ã¥ó¥Î¡¼¥É¤Î¾å°Ì¤Ë¹¹¤Ë¡¢¤³¤ì¤é¤ÎÁàºî¤ò¹Ô¤¦¤¿¤á¤Î¥Î¡¼¥É¤¬Äɲ䵤ì¤Þ¤¹¡£ ·«¤êÊÖ¤·¤Þ¤¹¤¬¡¢¤³¤¦¤·¤¿Áàºî¤ò¹Ô¤¦»þ¡¢Ä̾ïÊ£¿ô¤Î²ÄǽÀ­¤¬Â¸ºß¤·¤Þ¤¹¡£ ¤Ç¤¹¤Î¤Ç¡¢°Û¤Ê¤ë¥Î¡¼¥É¼ïÎब¤½¤³¤Ë½Ð¸½¤¹¤ë²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¡£ EXPLAIN¤Ë¤Ï¡¢·×²è¥Ä¥ê¡¼Æâ¤Î³Æ¥Î¡¼¥É¤ËÂФ·1¹Ô¤Î½ÐÎϤ¬¤¢¤ê¡¢´ðËܥΡ¼¥É¼ïÎà¤È¥×¥é¥ó¥Ê¤¬À¸À®¤·¤¿¤½¤Î·×²è¥Î¡¼¥É¤Î¼Â¹Ô¤ËÍפ¹¤ë¥³¥¹¥È¿äÄêÃͤò¼¨¤·¤Þ¤¹¡£ 1¹ÔÌܡʤâ¤Ã¤È¤â¾å°Ì¥Î¡¼¥É¡Ë¤Ë¤Ï¡¢·×²èÁ´ÂΤμ¹ԥ³¥¹¥È¿äÄêÃͤ¬´Þ¤Þ¤ì¤Þ¤¹¡£ ¥×¥é¥ó¥Ê¤Ï¤³¤ÎÃͤ¬ºÇ¾®¤Ë¤Ê¤ë¤è¤¦¤ËÆ°ºî¤·¤Þ¤¹¡£

¤É¤Î¤è¤¦¤Ê½ÐÎϤȤʤë¤Î¤«¤ò¼¨¤¹¤¿¤á¤À¤±¤Ë¡¢¤³¤³¤Ç´Êñ¤ÊÎã¤ò¼¨¤·¤Þ¤¹¡£ [1]

EXPLAIN SELECT * FROM tenk1;

                         QUERY PLAN
-------------------------------------------------------------
 Seq Scan on tenk1  (cost=0.00..458.00 rows=10000 width=244)

EXPLAIN¤¬½ÐÎϤ¹¤ë¿ôÃͤˤϰʲ¼¤Î¤â¤Î¤¬¤¢¤ê¤Þ¤¹¡£

¥³¥¹¥È¤Ï¡¢¼è¤ê½Ð¤¹¥Ç¥£¥¹¥¯¥Ú¡¼¥¸Ã±°Ì¤Ç¬Äꤵ¤ì¤Þ¤¹¡£ ¤Ä¤Þ¤ê¡¢1.0¤Ï°ì²ó¤Î¥·¡¼¥±¥ó¥·¥ã¥ë¤Ê¥Ç¥£¥¹¥¯¥Ú¡¼¥¸Æɤ߼è¤ê¤ÈÄêµÁ¤µ¤ì¤Þ¤¹ ¡ÊCPU¤ÎÉéô¤Ë´Ø¤·¤Æ¤âƱÍͤˡ¢Å¬Åö¤Ë×ó°ÕŪ¤Ë·è¤á¤¿´ð½à¤Ë½¾¤Ã¤Æ¥Ç¥£¥¹¥¯¥Ú¡¼¥¸Ã±°Ì¤Ç´¹»»¤µ¤ì¤Þ¤¹¡£ ¤³¤ì¤é¤Î´ð½àÃͤθú²Ì¤òÃΤꤿ¤¤¾ì¹ç¤Ï¡¢¹à17.6.2¤Î¼Â¹Ô»þÀßÄê¥Ñ¥é¥á¡¼¥¿¤Î°ìÍ÷¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡Ë¡£

¾å°Ì¥Î¡¼¥É¤Î¥³¥¹¥È¤Ë¤Ï¡¢Á´¤Æ¤Î»Ò¥Î¡¼¥É¤Î¥³¥¹¥È¤â¤½¤ÎÃæ¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë¤³¤È¤Ë½½Ê¬Î±°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ ¤³¤Î¥³¥¹¥È¤Ï¥×¥é¥ó¥Ê¤¬´ØÍ¿¤¹¤ë¥³¥¹¥È¤Î¤ßÈ¿±Ç¤¹¤ëÅÀ¤â¤Þ¤¿½ÅÍפǤ¹¡£ ¤È¤ê¤ï¤±¡¢·ë²Ì¤Î¹Ô¤ò¥¯¥é¥¤¥¢¥ó¥È¤ËžÁ÷¤¹¤ë¥³¥¹¥È¤Ï¡¢¼ÂºÝ¤Î½èÍý»þ´Ö¤Î½ÅÍפÊÍ×°ø¤È¤Ê¤ë²ÄǽÀ­¤¬¤¢¤ë¤Ë¤â¤«¤«¤ï¤é¤º¡¢¹Í褵¤ì¤Þ¤»¤ó¡£ ¥×¥é¥ó¥Ê¤Ï¡¢·×²è¤ò¤¤¤«¤ËÊѹ¹¤·¤è¤¦¤È¡¢¤É¤¦¤¹¤ë¤³¤È¤â¤Ç¤­¤Ê¤¤¤¿¤á¡¢¤³¤ì¤ò̵»ë¤·¤Þ¤¹ ¡ÊÀµ¤·¤¤·×²è¤Ï¤É¤ó¤Ê¤â¤Î¤Ç¤¢¤ì¡¢Á´¤ÆƱ¤¸¹Ô¤ò·ë²Ì¤È¤·¤Æ½ÐÎϤ¹¤ë¤È¿®¤¸¤Æ¤¤¤Þ¤¹¡Ë¡£

½ÐÎϹԿô¤Ï·×²è¥Î¡¼¥É¤Ë¤è¤Ã¤Æ½èÍý¤¢¤ë¤¤¤Ï¥¹¥­¥ã¥ó¤µ¤ì¤¿¹Ô¿ô¤òɽ¤·¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢Â¿¾¯°·¤¤¤Ë¤¯¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ ³ºÅö¥Î¡¼¥É¤ËŬÍѤµ¤ì¤ëÁ´¤Æ¤ÎWHERE¶çÀ©Ì󤫤éÍè¤ëÁªÂòÀ­¿äÄêÃͤòÈ¿±Ç¤·¡¢Ä̾ᆵ¤Ê¤¤¹Ô¿ô¤Ë¤Ê¤ê¤Þ¤¹¡£ ÍýÁÛŪ¤Ë¤Ï¡¢ºÇ¾å°Ì¤Î¹Ô¿ô¤Î¿äÄêÃͤϡ¢¼ÂºÝ¤ËÌ䤤¹ç¤ï¤»¤Ë¤è¤Ã¤ÆÊÖ¤µ¤ì¡¢¹¹¿·¤µ¤ì¡¢¤¢¤ë¤¤¤Ïºï½ü¤µ¤ì¤¿³µ»»¤Î¹Ô¿ô¤È¤Ê¤ê¤Þ¤¹¡£

Îã¤ËÌá¤ê¤Þ¤¹¡£

EXPLAIN SELECT * FROM tenk1;

                         QUERY PLAN
-------------------------------------------------------------
 Seq Scan on tenk1  (cost=0.00..458.00 rows=10000 width=244)

¤³¤ì¤Ï¤Û¤È¤ó¤É¸«¤¿¤Þ¤Þ¤Ç¤¹¡£¤â¤·¡¢

SELECT relpages, reltuples FROM pg_class WHERE relname = 'tenk1';

¤ò¼Â¹Ô¤¹¤ë¤È¡¢tenk1¤Ë¤Ï358¤Î¥Ç¥£¥¹¥¯¥Ú¡¼¥¸¤È10000¤Î¹Ô¤¬¤¢¤ë¤³¤È¤¬¤ï¤«¤ê¤Þ¤¹¡£ ¤Ç¤¹¤«¤é¡¢Ã±°ÌÅö¤¿¤ê1.0¤È¥³¥¹¥È¤¬·è¤Þ¤Ã¤Æ¤¤¤ë358¥Ú¡¼¥¸¤ÎÆɤ߽Ф·¤Ë¡¢Ä̾ï0.01¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëcpu_tuple_cost¤ò10000Çܤ·¤¿¤â¤Î¤ò²Ã¤¨¤¿¤â¤Î¤¬¡¢¥³¥¹¥È¤Î¿äÄêÃͤˤʤë¤ï¤±¤Ç¤¹¡ÊSHOW cpu_tuple_cost¤ò»î¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡Ë¡£

¤Ç¤Ï¡¢WHERE¾ò·ï¤ò²Ã¤¨¤ÆÌ䤤¹ç¤ï¤»¤òÊѹ¹¤·¤Æ¤ß¤Þ¤¹¡£

EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 7000;

                         QUERY PLAN
------------------------------------------------------------
 Seq Scan on tenk1  (cost=0.00..483.00 rows=7033 width=244)
   Filter: (unique1 < 7000)

EXPLAIN¤Î½ÐÎϤ¬Å¬ÍѤµ¤ì¤ëWHERE¶ç¤¬"¥Õ¥£¥ë¥¿"¾ò·ï¤È¤·¤Æɽ¼¨¤·¤Æ¤¤¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ ¤³¤ì¤Ï¡¢¤³¤Î·×²è¥Î¡¼¥É¤¬¥¹¥­¥ã¥ó¤·¤¿³Æ¹Ô¤ËÂФ·¤Æ¤½¤Î¾ò·ï¤ò¸¡ºº¤¹¤ë¤³¤È¤ò°ÕÌ£¤·¡¢¤½¤Î¾ò·ï¤òÄ̲ᤷ¤¿¤â¤Î¤Î¤ß¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£ WHERE¶ç¤¬¤¢¤ë¤¿¤á¡¢½ÐÎϹԿô¤Î¸«ÀѤ꤬¾®¤µ¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ ¤·¤«¤·¡¢°ÍÁ³¤È¤·¤Æ10000¹ÔÁ´¤Æ¤ò¥¹¥­¥ã¥ó¤¹¤ëɬÍפ¬¤¢¤ë¤¿¤á¡¢¥³¥¹¥È¤Ï¾®¤µ¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤»¤ó¡£ ¼ÂºÝ¤Ë¤Ï¡¢WHERE¾ò·ï¤ò¸¡ºº¤¹¤ë¤¿¤á¤ËCPU»þ´Ö¤¬Í¾·×¤Ë¤«¤«¤ë¤³¤È¤òÈ¿±Ç¤·¤Æ¡¢¤Û¤ó¤Î¾¯¤·¤Ç¤¹¤¬¥³¥¹¥È¤¬¾å¾º¤·¤Æ¤¤¤Þ¤¹¡£

¤³¤ÎÌ䤤¹ç¤ï¤»¤¬ÁªÂò¤¹¤ë¼ÂºÝ¤Î¹Ô¿ô¤Ï7000¤Ç¤¹¡£ ¤·¤«¤·¡¢¹Ô¿äÄê¤Ï³µ»»Ãͤ˲᤮¤Þ¤»¤ó¡£ ¤³¤Î¼Â¸³¤ò2²ó¼Â¹Ô¤·¤¿¾ì¹ç¡¢¤ª¤½¤é¤¯Â¿¾¯°Û¤Ê¤ë¿äÄêÃͤòÆÀ¤ë¤Ç¤·¤ç¤¦¡£ ¤â¤Ã¤È¸À¤¦¤È¡¢¤³¤ì¤ÏANALYZE¥³¥Þ¥ó¥É¤ò¹Ô¤¦ÅÙ¤ËÊѲ½¤·¤Þ¤¹¡£ ¤Ê¤¼¤Ê¤é¡¢ANALYZE¤ÇÀ¸À®¤µ¤ì¤ëÅý·×¾ðÊó¤Ï¡¢¥Æ¡¼¥Ö¥ë¤Î¥é¥ó¥À¥à¤ÊɸËܤ«¤é¼è¤ê½Ð¤µ¤ì¤ë¤«¤é¤Ç¤¹¡£

¤Ç¤Ï¡¢¾ò·ï¤ò¤è¤ê¶¯¤¯À©¸Â¤·¤Æ¤ß¤Þ¤¹¡£

EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 100;

                                  QUERY PLAN
------------------------------------------------------------------------------
 Bitmap Heap Scan on tenk1  (cost=2.37..232.35 rows=106 width=244)
   Recheck Cond: (unique1 < 100)
   ->  Bitmap Index Scan on tenk1_unique1  (cost=0.00..2.37 rows=106 width=0)
         Index Cond: (unique1 < 100)

¤³¤³¤Ç¤Ï¡¢¥×¥é¥ó¥Ê¤Ï2Ãʳ¬¤Î·×²è¤ò»ÈÍѤ¹¤ë¤³¤È¤ò·èÄꤷ¤Þ¤·¤¿¡£ ºÇ²¼Áؤηײè¥Î¡¼¥É¤Ï¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»ÈÍѤ·¤Æ¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¾ò·ï¤Ë¹ç¤¦¹Ô¤Î¾ì½ê¤ò¸¡º÷¤·¤Þ¤¹¡£ ¤½¤·¤Æ¡¢¾å°Ì·×²è¥Î¡¼¥É¤¬¼ÂºÝ¤Ë¥Æ¡¼¥Ö¥ë¼«ÂΤ«¤é¤³¤ì¤é¤Î¹Ô¤ò¼è¤ê½Ð¤·¤Þ¤¹¡£ ¹Ô¤òÊÌ¡¹¤Ë¼è¤ê½Ð¤¹¤³¤È¤Ï¡¢¥·¡¼¥±¥ó¥·¥ã¥ë¤ÊÆɤ߼è¤ê¤ËÈæ¤ÙÈó¾ï¤Ë¹â²Á¤Ç¤¹¡£ ¤·¤«¤·¡¢¥Æ¡¼¥Ö¥ë¤Î¤¹¤Ù¤Æ¤Î¥Ú¡¼¥¸¤òÆɤ߼è¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¤Î¤Ç¡¢¥·¡¼¥±¥ó¥·¥ã¥ë¥¹¥­¥ã¥ó¤è¤êÄã²Á¤Ë¤Ê¤ê¤Þ¤¹ ¡Ê2Ãʳ¬¤Î·×²è¤ò»ÈÍѤ¹¤ëÍýͳ¤Ï¡¢ÊÌ¡¹¤Ë¹Ô¤ò¼è¤ê½Ð¤¹¥³¥¹¥È¤òºÇ¾®¤Ë¤¹¤ë¤¿¤á¤Ë¡¢¾å°Ì¤Î·×²è¥Î¡¼¥É¤¬¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ë¤è¤ê¼±Ê̤µ¤ì¤¿¹Ô¤Î°ÌÃÖ¤òÆɤ߼è¤êÁ°¤ËʪÍýŪ¤Ê½ç½ø¤Ç¥½¡¼¥È¤¹¤ë¤³¤È¤Ç¤¹¡£ ¥Î¡¼¥É¤Çµ­ºÜ¤µ¤ì¤Æ¤¤¤ë"bitmap"¤Ï¡¢¥½¡¼¥È¤ò¹Ô¤¦µ¡¹½¤Î̾Á°¤Ç¤¹¡Ë¡£

WHERE¾ò·ï¤ÎÁªÂòÀ­¤¬½½Ê¬¤Ç¤¢¤ì¤Ð¡¢¥×¥é¥ó¥Ê¤Ï"ñ½ã¤Ê"¥¤¥ó¥Ç¥Ã¥¯¥¹¥¹¥­¥ã¥ó·×²è¤ËÀÚ¤êÂؤ¨¤Þ¤¹¡£

EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 3;

                                  QUERY PLAN
------------------------------------------------------------------------------
 Index Scan using tenk1_unique1 on tenk1  (cost=0.00..10.00 rows=2 width=244)
   Index Cond: (unique1 < 3)

¤³¤Î¾ì¹ç¡¢¥Æ¡¼¥Ö¥ë¹Ô¤Ï¥¤¥ó¥Ç¥Ã¥¯¥¹¤Î½çÈ֤Ǽè¤ê½Ð¤µ¤ì¤Þ¤¹¡£ ¤³¤ì¤Ï¹â²Á¤ÊÆɤ߼è¤ê¤Ê¤Î¤Ç¤¹¤¬¡¢¹Ô¿ô¤¬¾¯¤Ê¤¤¤¿¤á¡¢¹Ô°ÌÃÖ¤ò¥½¡¼¥È¤¹¤ë;·×¤Ê¥³¥¹¥È¤ò¤«¤±¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£ ñ°ì¹Ô¤Î¤ß¤ò¼è¤ê½Ð¤¹Ì䤤¹ç¤ï¤»¤ä¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹½ç¤Ë°ìÃפ¹¤ëORDER BY¾ò·ï¤òÍ׵᤹¤ëÌ䤤¹ç¤ï¤»¤Ç¤Ï¡¢¤³¤Î¼ï¤Î·×²è¼ïÎà¤ò¤è¤¯¸«¤«¤±¤Þ¤¹¡£

WHERE¾ò·ï¤Ë¶ç¤ò¤â¤¦1¤ÄÄɲä·¤Þ¤¹¡£

EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 3 AND stringu1 = 'xxx';

                                  QUERY PLAN
------------------------------------------------------------------------------
 Index Scan using tenk1_unique1 on tenk1  (cost=0.00..10.01 rows=1 width=244)
   Index Cond: (unique1 < 3)
   Filter: (stringu1 = 'xxx'::name)

Äɲä·¤¿¶çstringu1 = 'xxx'¤Ë¤è¤ê½ÐÎϹԿô¤Î¿äÄêÃͤϸº¾¯¤¹¤ë¤â¤Î¤Î¡¢¸¡ºº¤¹¤ë¹Ô¤Î½¸¹ç¤ÏÊѤï¤é¤Ê¤¤¤¿¤á¤Ë¥³¥¹¥È¤Ï¸º¤Ã¤Æ¤¤¤Þ¤»¤ó¡£ ¤³¤Îstringu1¶ç¤Ï¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¾ò·ï¤È¤·¤Æ¤ÏŬÍѤǤ­¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡Ê¤³¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ï¡¢unique1Îó¤Î¤ß¤òÂоݤȤ·¤Æ¤¤¤ë¤«¤é¤Ç¤¹¡Ë¡£ ¤½¤ÎÂå¤ï¤ê¡¢stringu1¶ç¤Ï¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ë¤è¤Ã¤ÆÃê½Ð¤µ¤ì¤¿¹Ô¤Î¥Õ¥£¥ë¥¿¤È¤·¤ÆŬÍѤµ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤³¤ì¤Ë¤è¤ê¡¢ÄɲÃʬ¤Î¥Á¥§¥Ã¥¯¤òÈ¿±Ç¤¹¤ë¤¿¤á¡¢¥³¥¹¥È¤Ï¼ÂºÝ¤Ë¤Ï¾¯¤·¾å¤¬¤ê¤Þ¤¹¡£

WHERE¶ç¤Ç»ÈÍѤµ¤ì¤ëÊ£¿ô¤ÎÎó¤ËÂФ¹¤ë¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬Â¸ºß¤¹¤ë¾ì¹ç¡¢¥×¥é¥ó¥Ê¤Ï¥¤¥ó¥Ç¥Ã¥¯¥¹¤òAND¤äOR¤ÇÁȤ߹ç¤ï¤»¤Æ»ÈÍѤ¹¤ë¤³¤È¤òÁªÂò¤¹¤ë²ÄǽÀ­¤¬¤¢¤ê¤Þ¤¹¡£

EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 100 AND unique2 > 9000;

                                     QUERY PLAN
-------------------------------------------------------------------------------------
 Bitmap Heap Scan on tenk1  (cost=11.27..49.11 rows=11 width=244)
   Recheck Cond: ((unique1 < 100) AND (unique2 > 9000))
   ->  BitmapAnd  (cost=11.27..11.27 rows=11 width=0)
         ->  Bitmap Index Scan on tenk1_unique1  (cost=0.00..2.37 rows=106 width=0)
               Index Cond: (unique1 < 100)
         ->  Bitmap Index Scan on tenk1_unique2  (cost=0.00..8.65 rows=1042 width=0)
               Index Cond: (unique2 > 9000)

¤·¤«¤·¡¢¤³¤ì¤ÏξÊý¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»²¾È¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£ ¤½¤Î¤¿¤á¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò1¤Ä»ÈÍѤ·¡¢Â¾¤Î¾ò·ï¤Ë¤Ä¤¤¤Æ¤Ï¥Õ¥£¥ë¥¿¤È¤·¤Æ°·¤¦ÊýË¡¤ÈÈæ¤Ù¤Æ¾ï¤Ë¾¡¤ë¤È¤Ï¸Â¤ê¤Þ¤»¤ó¡£ ´Þ¤Þ¤ì¤ëÈϰϤòÊѹ¹¤¹¤ë¤È¡¢¤½¤ì¤Ëȼ¤¤·×²è¤âÊѤï¤ë¤³¤È¤¬Ê¬¤«¤ë¤Ç¤·¤ç¤¦¡£

º£¤Þ¤ÇÀâÌÀ¤Ë»È¤Ã¤Æ¤­¤¿¥Õ¥£¡¼¥ë¥É¤ò»È¤Ã¤Æ2¤Ä¤Î¥Æ¡¼¥Ö¥ë¤ò·ë¹ç¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£

EXPLAIN SELECT * FROM tenk1 t1, tenk2 t2 WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2;

                                      QUERY PLAN
--------------------------------------------------------------------------------------
 Nested Loop  (cost=2.37..553.11 rows=106 width=488)
   ->  Bitmap Heap Scan on tenk1 t1  (cost=2.37..232.35 rows=106 width=244)
         Recheck Cond: (unique1 < 100)
         ->  Bitmap Index Scan on tenk1_unique1  (cost=0.00..2.37 rows=106 width=0)
               Index Cond: (unique1 < 100)
   ->  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.00..3.01 rows=1 width=244)
         Index Cond: ("outer".unique2 = t2.unique2)

¤³¤ÎÆþ¤ì»Ò¾õ¥ë¡¼¥×·ë¹ç¤Ç¤Ï¡¢³°Éô¥¹¥­¥ã¥ó¤Ë¡¢ºÇ¸å¤ÎÎã¤Ç¼¨¤·¤¿¤Î¤ÈƱ¤¸¥Ó¥Ã¥È¥Þ¥Ã¥×¥¤¥ó¥Ç¥Ã¥¯¥¹¥¹¥­¥ã¥ó¤¬»È¤ï¤ì¤Æ¤¤¤Þ¤¹¡£ ¤½¤·¤Æ¡¢unique1 < 100 WHERE¶ç¤ò³ºÅö¥Î¡¼¥É¤ËŬÍѤ·¤Æ¤¤¤ë¤¿¤á¡¢¥³¥¹¥È¤È½ÐÎϹԿô¤ÏÊѤï¤Ã¤Æ¤¤¤Þ¤»¤ó¡£ ¤³¤ÎÃʳ¬¤Ç¤Ït1.unique2 = t2.unique2¶ç¤Ï´Ø·¸¤·¤Æ¤ª¤é¤º¡¢³°Éô¥¹¥­¥ã¥ó¤Ë¤ª¤±¤ë½ÐÎϹԿô¤Ë±Æ¶Á¤·¤Æ¤¤¤Þ¤»¤ó¡£ ÆâÉô¥¹¥­¥ã¥ó¤Ç¤Ï¡¢³°Éô¥¹¥­¥ã¥ó¤Ë¤ª¤±¤ë¸½ºß¤Î¹Ô¤Îunique2¤ÎÃͤ¬ÆâÉô¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¥¹¥­¥ã¥ó¤ËÅꤲ¹þ¤Þ¤ì¡¢t2.unique2 = constant¤Î¤è¤¦¤Ê¥¤¥ó¥Ç¥Ã¥¯¥¹¾ò·ï¤òÀ¸À®¤·¤Þ¤¹¡£ ¤·¤¿¤¬¤Ã¤Æ¡¢ÆâÉô¥¹¥­¥ã¥ó¤Î·×²è¤È¥³¥¹¥È¤Ï¡¢Î㤨¤ÐEXPLAIN SELECT * FROM tenk2 WHERE unique2 = 42¤Î¤è¤¦¤ÊÌ䤤¹ç¤ï¤»¤ÈƱ¤¸¤Ç¤¹¡£ ¥ë¡¼¥×¥Î¡¼¥É¤Î¥³¥¹¥È¤Ï¡¢³°Éô¥¹¥­¥ã¥ó¤Î¥³¥¹¥È¤È¡¢³Æ¡¹¤Î³°Éô¤Î¹Ô¤ËÂФ·¤ÆÆâÉô¥¹¥­¥ã¥ó¤¬·«¤êÊÖ¤µ¤ì¤ë¤³¤È¤Ë¤è¤ë¥³¥¹¥È¡Ê¤³¤³¤Ç¤Ï106 * 3.01¡Ë¤ò²Ã¤¨¡¢¤µ¤é¤Ë·ë¹ç½èÍý¤ò¹Ô¤¦¤¿¤á¤Î¾¯¡¹¤ÎCPU»þ´Ö¤ò²Ã¤¨¤¿¤â¤Î¤Ë¤Ê¤ê¤Þ¤¹¡£

¤³¤ÎÎã¤Ç¤Ï¡¢·ë¹ç¤Î½ÐÎϹԿô¤Ï2¤Ä¤Î¥¹¥­¥ã¥ó¤Î½ÐÎϹԿô¤ÎÀѤËÅù¤·¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢¤¤¤Ä¤â¤½¤¦¤Ê¤ë¤ï¤±¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£ ¤¿¤¤¤Æ¤¤¤Î¾ì¹ç¡¢2¤Ä¤Î¥Æ¡¼¥Ö¥ë¤Ë´Ø·¸¤¹¤ëWHERE¶ç¤¬¤¢¤Ã¤Æ¡¢¤½¤ÎWHERE¶ç¤ÏÆþÎÏ¥¹¥­¥ã¥ó»þ¤Ç¤Ï¤Ê¤¯¡¢·ë¹ç¤ò¹Ô¤¦ºÝ¤ËŬÍѤµ¤ì¤ë¤«¤é¤Ç¤¹¡£ Î㤨¤Ð¡¢WHERE ... AND t1.hundred < t2.hundred¤È¤¤¤¦¶ç¤òÄɲä·¤¿¤È¤¹¤ë¤È¡¢·ë¹ç¥Î¡¼¥É¤Î½ÐÎϹԿô¤ò¸º¤é¤·¤Ï¤·¤Þ¤¹¤¬¡¢ÆþÎÏ¥¹¥­¥ã¥ó¤Ë¤Ï±Æ¶Á¤·¤Þ¤»¤ó¡£

¹à17.6.1¤Ëµ­ºÜ¤·¤¿enable/disable¥Õ¥é¥°¤ò»ÈÍѤ·¤Æ¡¢¥×¥é¥ó¥Ê¤¬ºÇ¤âÎɤ¤¤È¹Í¤¨¤Æ¤¤¤ëÀïά¤ò¶¯À©Åª¤Ë̵»ë¤µ¤»¤ëÊýË¡¤Ë¤è¤ê¡¢°Û¤Ê¤Ã¤¿·×²è¤ò´Ñ»¡¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹ ¡ÊÈó¾ï¤Ë¸¶»ÏŪ¤Ê¥Ä¡¼¥ë¤Ç¤¹¤¬¡¢ÍøÍѲÁÃͤ¬¤¢¤ê¤Þ¤¹¡£ ¹à13.3¤â»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡Ë¡£

SET enable_nestloop = off;
EXPLAIN SELECT * FROM tenk1 t1, tenk2 t2 WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2;

                                        QUERY PLAN
------------------------------------------------------------------------------------------
 Hash Join  (cost=232.61..741.67 rows=106 width=488)
   Hash Cond: ("outer".unique2 = "inner".unique2)
   ->  Seq Scan on tenk2 t2  (cost=0.00..458.00 rows=10000 width=244)
   ->  Hash  (cost=232.35..232.35 rows=106 width=244)
         ->  Bitmap Heap Scan on tenk1 t1  (cost=2.37..232.35 rows=106 width=244)
               Recheck Cond: (unique1 < 100)
               ->  Bitmap Index Scan on tenk1_unique1  (cost=0.00..2.37 rows=106 width=0)
                     Index Cond: (unique1 < 100)

¤³¤Î·×²è¤Ç¤Ï¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¥¹¥­¥ã¥ó¤ò»È¤Ã¤Ætenk1¤«¤éɬÍפÊ100¹Ô¤ò¼è¤ê½Ð¤·¤Æ¥á¥â¥ê¾å¤Î¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤Ë³ÊǼ¤·¡¢¤½¤Î¸å¡¢tenk2¤ò¥·¡¼¥±¥ó¥·¥ã¥ë¥¹¥­¥ã¥ó¤·¤Æ¡¢tenk2¤Î¹Ô¤´¤È¤Ët1.unique2 = t2.unique2¤òËþ¤¿¤¹¤«¤É¤¦¤«¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤ò¸¡ºº¤·¤Þ¤¹¡£ tenk1¤òÆɤ߼è¤ê¡¢¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤òÀßÄꤹ¤ë¤¿¤á¤Î¥³¥¹¥È¤Ï¡¢tenk2¤ÎÆɤ߼è¤ê¤ò»Ï¤á¤ë¤Þ¤Ç¹Ô¤òÆþ¼ê¤·¤Þ¤»¤ó¤Î¤Ç¡¢´°Á´¤Ë¥Ï¥Ã¥·¥å·ë¹ç¤Î½é´ü¥³¥¹¥È¤È¤Ê¤ê¤Þ¤¹¡£ ¤Þ¤¿¡¢¤³¤Î·ë¹ç¤Î¿äÄêÁí»þ´Ö¤Ë¤Ï¡¢¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤ò10000²ó¸¡ºº¤¹¤ë¡¢Â礭¤ÊCPU»þ´Ö¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤·¤«¤·¡¢¤³¤Î·×²è·¿¤Ç¤Ï¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤ÎÀßÄê¤Ï°ìÅ٤ΤߤΤ¿¤á¡¢10000¡ß232.35ʬ¤Î¥³¥¹¥È¤Ï¤«¤«¤é¤Ê¤¤¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£

EXPLAIN ANALYZE¤ò»ÈÍѤ·¤Æ¡¢¥×¥é¥ó¥Ê¤¬¿äÄꤹ¤ë¥³¥¹¥È¤ÎÀºÅÙ¤òÅÀ¸¡¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ ¤³¤Î¥³¥Þ¥ó¥É¤Ï¼ÂºÝ¤Ë¤½¤ÎÌ䤤¹ç¤ï¤»¤ò¼Â¹Ô¤·¡¢·×²è¥Î¡¼¥É¤´¤È¤ËÍפ·¤¿¼ÂºÝ¤Î¼Â¹Ô»þ´Ö¤ò¡¢ÉáÄ̤ÎEXPLAIN¤¬¼¨¤¹¿äÄꥳ¥¹¥È¤ÈƱ¤¸ÃͤȰì½ï¤Ëɽ¼¨¤·¤Þ¤¹¡£ Î㤨¤Ð¡¢°Ê²¼¤Î¤è¤¦¤Ê·ë²Ì¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

EXPLAIN ANALYZE SELECT * FROM tenk1 t1, tenk2 t2 WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2;

                                                            QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------
 Nested Loop  (cost=2.37..553.11 rows=106 width=488) (actual time=1.392..12.700 rows=100 loops=1)
   ->  Bitmap Heap Scan on tenk1 t1  (cost=2.37..232.35 rows=106 width=244) (actual time=0.878..2.367 rows=100 loops=1)
         Recheck Cond: (unique1 < 100)
         ->  Bitmap Index Scan on tenk1_unique1  (cost=0.00..2.37 rows=106 width=0) (actual time=0.546..0.546 rows=100 loops=1)
               Index Cond: (unique1 < 100)
   ->  Index Scan using tenk2_unique2 on tenk2 t2  (cost=0.00..3.01 rows=1 width=244) (actual time=0.067..0.078 rows=1 loops=100)
         Index Cond: ("outer".unique2 = t2.unique2)
 Total runtime: 14.452 ms

"actual time"Ãͤϼ»þ´Ö¤ò¥ß¥êÉÃñ°Ì¤Çɽ¤µ¤ì¤Æ¤¤¤ë¤³¤È¡¢"cost"¿äÄêÃͤϥǥ£¥¹¥¯Æɤ߼è¤ê¤Ë´Ø¤¹¤ë²¿¤é¤«¤Îñ°Ì¤Çɽ¤µ¤ì¤Æ¤¤¤ë¤³¤È¤ËÃí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£ ¤Ç¤¹¤«¤é¤½¤Î¤Þ¤ÞÈæ³Ó¤¹¤ë¤³¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£ ÃíÌܤ¹¤ëÅÀ¤Ï¤½¤Î³ä¹ç¤Ç¤¹¡£

Ì䤤¹ç¤ï¤»·×²è¤ÎÃæ¤Ë¤Ï¡¢²¿²ó¤âÉû·×²è¥Î¡¼¥É¤ò¼Â¹Ô¤Ç¤­¤ë¤â¤Î¤¬¤¢¤ê¤Þ¤¹¡£ Î㤨¤Ð¡¢¾å½Ò¤ÎÆþ¤ì»Ò¾õ¥ë¡¼¥×¤Î·×²è¤Ç¤Ï¡¢ÆâÉô¥¤¥ó¥Ç¥Ã¥¯¥¹¥¹¥­¥ã¥ó¤Ï³°Éô¤Î¹Ô¤´¤È¤Ë°ìÅÙ¹Ô¤ï¤ì¤Þ¤¹¡£ ¤³¤Î¤è¤¦¤Ê¾ì¹ç¡¢"loops"ÃͤϤ½¤Î¥Î¡¼¥É¤ò¼Â¹Ô¤¹¤ëÁí²ó¿ô¤òÊó¹ð¤·¡¢É½¼¨¤µ¤ì¤ë¼ÂºÝ¤Î»þ´Ö¤È¹Ô¿ô¤Ï1¼Â¹ÔÅö¤¿¤ê¤ÎÊ¿¶Ñ¤Ç¤¹¡£ ¤³¤ì¤Ïɽ¼¨¤µ¤ì¤¿¿äÄꥳ¥¹¥È¤ÈÈæ³Ó¤Ç¤­¤ëÃͤòºîÀ®¤¹¤ë¤³¤È¤Ç¹Ô¤¤¤Þ¤¹¡£ "loops"Ãͤò¤«¤±¤ë¤³¤È¤Ç¡¢¤½¤Î¥Î¡¼¥É¤Ç¼ÂºÝ¤ËÈñ¤ä¤µ¤ì¤¿Áí»þ´Ö¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

EXPLAIN ANALYZE¤Çɽ¼¨¤µ¤ì¤ëTotal runtime¡ÊÁí¼Â¹Ô»þ´Ö¡Ë¤Ë¤Ï¡¢·ë²Ì¹Ô¤òÁàºî¤¹¤ë¤¿¤á¤Î»þ´Ö¤Î¾¤Ë¡¢¥¨¥¯¥¼¥­¥å¡¼¥¿¤Îµ¯Æ°¡¢Ää»ß»þ´Ö¤â´Þ¤Þ¤ì¤Þ¤¹¡£ ²òÀϤä½ñ¤­´¹¤¨¡¢·×²èºîÀ®¤Î»þ´Ö¤Ï´Þ¤Þ¤ì¤Þ¤»¤ó¡£ SELECTÌ䤤¹ç¤ï¤»¤Ç¤Ï¡¢Áí¼Â¹Ô»þ´Ö¤ÏºÇ¾å°Ì·×²è¥Î¡¼¥É¤ÇÊó¹ð¤µ¤ì¤ëÁí»þ´Ö¤è¤ê¤âÄ̾ᆵ¤·Â礭¤¯¤Ê¤ê¤Þ¤¹¡£ INSERT¡¢UPDATE¡¢¤ª¤è¤ÓDELETE¥³¥Þ¥ó¥É¤Ç¤Ï¡¢¤½¤ÎÁí¼Â¹Ô»þ´Ö¤Ï¤«¤Ê¤êÂ礭¤¯¤Ê¤ê¤Þ¤¹¡£ ¤½¤³¤Ë¤Ï¡¢·ë²Ì¹Ô¤ò½èÍý¤¹¤ë»þ´Ö¤¬´Þ¤Þ¤ì¤ë¤«¤é¤Ç¤¹¡£ ¤³¤ì¤é¤Î¥³¥Þ¥ó¥É¤Ç¤Ï¡¢ºÇ¾å°Ì·×²è¥Î¡¼¥É¤Î»þ´Ö¤Ï¡¢´ðËÜŪ¤Ë¿·¤·¤¤¹Ô¤ò±é»»¤·¡¢¸Å¤¤¹Ô¤Î¾ì½ê¤ò·èÄꤹ¤ë¤¿¤á¤Î»þ´Ö¤ò¼¨¤·¡¢¤½¤³¤Ë¤ÏÊѹ¹¤ò¹Ô¤¦»þ´Ö¤Ï´Þ¤Þ¤ì¤Þ¤»¤ó¡£ ¥È¥ê¥¬¤¬È¯¹Ô¤µ¤ì¤ë¾ì¹ç¡¢¥È¥ê¥¬¤Îȯ¹Ô¤Ë¤«¤«¤ë»þ´Ö¤âºÇ¾å°Ì·×²è¥Î¡¼¥É¤Ë¤Ï´Þ¤Þ¤ì¤º¡¢¥È¥ê¥¬Ëè¤ËÊÌ¡¹¤Ëɽ¼¨¤µ¤ì¤Þ¤¹¡£

EXPLAIN¤Î·ë²Ì¤ò»î¸³¤ò¹Ô¤Ã¤¿¤â¤Î°Ê³°¤Î¿äÄê¤Ë»È¤Ã¤Æ¤Ï¤¤¤±¤Ê¤¤¤³¤È¤Ï¸À¤¦¤Þ¤Ç¤â¤¢¤ê¤Þ¤»¤ó¡£ Î㤨¤Ð¡¢¾®¤µ¤Ê¥Æ¡¼¥Ö¥ë¤Î·ë²Ì¤Ï¡¢µðÂç¤Ê¥Æ¡¼¥Ö¥ë¤ËŬÍѤǤ­¤ë¤È¤Ï²¾Äê¤Ç¤­¤Þ¤»¤ó¡£ ¥×¥é¥ó¥Ê¤Î¿äÄꥳ¥¹¥È¤ÏÀþ·Á¤Ç¤Ï¤Ê¤¯¡¢¤½¤Î¤¿¤á¡¢¥Æ¡¼¥Ö¥ë¤ÎÂç¾®¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë·×²è¤òÁªÂò¤·¤Þ¤¹¡£ ¶Ëü¤ÊÎã¤Ç¤¹¤¬¡¢¥Æ¡¼¥Ö¥ë¤¬1¥Ç¥£¥¹¥¯¥Ú¡¼¥¸¤·¤«Àê¤á¤Ê¤¤¾ì¹ç¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¤¬»ÈÍѤǤ­¤ë¡¢¤Ç¤­¤Ê¤¤¤Ë´Ø·¸¤Ê¤¯¡¢¤Û¤È¤ó¤É¾ï¤Ë¥·¡¼¥±¥ó¥·¥ã¥ë¥¹¥­¥ã¥ó·×²è¤òÆÀ¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£ ¥×¥é¥ó¥Ê¤Ï¡¢¤É¤Î¤è¤¦¤Ê¾ì¹ç¤Ç¤â¥Æ¡¼¥Ö¥ë¤ò½èÍý¤¹¤ë¤¿¤á¤Ë1¥Ç¥£¥¹¥¯¥Ú¡¼¥¸Æɤ߼è¤ê¤ò¹Ô¤¦¤Î¤Ç¡¢¥¤¥ó¥Ç¥Ã¥¯¥¹¤ò»²¾È¤¹¤ë¤¿¤á¤ÎÄɲÃŪ¥Ú¡¼¥¸Æɤ߼è¤ê¤ò¹Ô¤¦²ÁÃͤ¬¤Ê¤¤¤³¤È¤òÃΤäƤ¤¤Þ¤¹¡£

Ãí°Õ

[1]

ËÜÀá¤ÎÎã¤Ï¡¢8.1³«È¯ÈÇ¥½¡¼¥¹¤Î¥ê¥°¥ì¥Ã¥·¥ç¥ó»î¸³¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¡¢VACUUM ANALYZE¤ò¼Â¹Ô¤·¤¿¸å¤Ç¼è¤ê½Ð¤·¤¿¤â¤Î¤Ç¤¹¡£ ¼ÂºÝ¤Ë¤³¤ÎÎã¤ò»î¤¹¤È¡¢»÷¤¿¤è¤¦¤Ê·ë²Ì¤Ë¤Ê¤ë¤Ï¤º¤Ç¤¹¤¬¡¢¤ª¤½¤é¤¯¿äÄꥳ¥¹¥È¤ä¹Ô¿ô¤Ï¿¾¯°Û¤Ê¤ë¤³¤È¤Ë¤Ê¤ë¤Ç¤·¤ç¤¦¡£ ANALYZE¤Ë¤è¤ëÅý·×¾ðÊó¤Ï¸·Ì©¤Ê¤â¤Î¤Ç¤Ï¤Ê¤¯¥é¥ó¥À¥à¤Ê¥µ¥ó¥×¥ê¥ó¥°¤ò¹Ô¤Ã¤¿·ë²Ì¤Ç¤¢¤ë¤«¤é¤Ç¤¹¡£