{"id":2698,"date":"2013-06-07T17:32:55","date_gmt":"2013-06-07T08:32:55","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=2698"},"modified":"2018-11-14T16:33:55","modified_gmt":"2018-11-14T07:33:55","slug":"postgresql-index-only-scan-%e5%a5%ae%e9%97%98%e8%a8%98-%e3%81%9d%e3%81%ae3","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2013\/06\/07\/postgresql-index-only-scan-%e5%a5%ae%e9%97%98%e8%a8%98-%e3%81%9d%e3%81%ae3\/","title":{"rendered":"PostgreSQL Index Only Scan \u596e\u95d8\u8a18 \u305d\u306e3"},"content":{"rendered":"<p>\u3069\u3046\u3082\u3002\u6751\u4e0a\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u30673\u56de\u76ee\u306ePostgreSQL\u3067\u3059\u3002<\/p>\n<p>\u4eca\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p>\u8ffd\u8a18\u578b\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3<br \/>\n\u30d0\u30ad\u30e5\u30fc\u30e0<br \/>\nVisibility Map\u3000\u3000\u2190 \u524d\u56de\u3053\u3053\u307e\u3067<br \/>\n\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50 \u2190 \u4eca\u56de\u3053\u3053<br \/>\nIndex Only Scan<\/p>\n<p>\u3067\u306f\u300c\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u300d\u3044\u3063\u3066\u307f\u3088\u3046\uff01\uff01<\/p>\n<h2>\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\uff1f\uff1f\uff1f<\/h2>\n<p>\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u3063\u3066\u3042\u307e\u308a\u805e\u304d\u306a\u308c\u306a\u3044\u3067\u3059\u3051\u3069\u3001\u7c21\u5358\u306b\u8a00\u3046\u3068\u300cexplain\u300d\u3057\u305f\u3089\u51fa\u3066\u304f\u308b\u30a2\u30ec\u3067\u3059\u3002<\/p>\n<pre class=\"lang:sql decode:true\">=# explain select * from users;\r\nQUERY PLAN\r\n-------------------------------------------------------------------\r\n Seq Scan on users  \r\n(cost=0.00..385179.80 rows=10010480 width=190)<\/pre>\n<p>\u4e0a\u306e\u300cSeq Scan\u300d\u3063\u3066\u306e\u304c\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u3067\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u3092\u63a2\u3057\u306b\u884c\u304f\u3068\u304d\u306b\u3001\u3044\u308d\u3044\u308d\u306a\u63a2\u3057\u65b9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u4e0a\u304b\u3089\u9806\u306b\u63a2\u3057\u305f\u308a\u3001\u30c7\u30fc\u30bf\u304c\u3042\u308a\u305d\u3046\u306a\u5834\u6240\u3092\u63a2\u3057\u305f\u308a\u306a\u3069\u3067\u3059\u3002<br \/>\n\u305d\u306e\u300c\u63a2\u3057\u65b9\u300d\u304c\u300c\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u300d\u3068\u3044\u3046\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u3092\u3044\u308d\u3044\u308d\u3068\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>Seq Scan<\/h2>\n<p>\u307e\u305a\u306f\u300cSeq Scan\u300d\u304b\u3089\uff01\uff01<\/p>\n<p>Seq Scan\u306f\u6700\u3082\u57fa\u672c\u7684\u306a\u3082\u306e\u3067\u3001\u5358\u306b\u8868\u3092\u6700\u521d\u304b\u3089\u6700\u5f8c\u3078\u3068\u30b9\u30ad\u30e3\u30f3\u3059\u308b\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-1.png\" rel=\"facebox\" rel=\"attachment wp-att-2702\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-2702\" alt=\"postgresql-techscore-blog3-1\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-1.png\" width=\"296\" height=\"300\" \/><\/a><\/p>\n<p>Explain\u3067\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<pre class=\"lang:sql decode:true\">=# explain select * from users where mail_address = 'hoge@example.com';\r\n                         QUERY PLAN\r\n-----------------------------------------------------------------------\r\n Seq Scan on users  (cost=0.00..410075.00 rows=1 width=190)\r\n   Filter: ((mail_address)::text = 'hoge@example.com'::text)<\/pre>\n<p>\u5168\u884c\u30b9\u30ad\u30e3\u30f3\u3059\u308b\u306e\u3067\u3001\u30ec\u30b3\u30fc\u30c9\u306e\u591a\u3044\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u4e0d\u5411\u304d\u3067\u3059\u3002<br \/>\n\u305d\u3046\u3044\u3046\u6642\u306f\u6b21\u306b\u8aac\u660e\u3059\u308bIndex Scan\u304c\u826f\u3044\u3067\u3059\u3002<\/p>\n<h2>Index Scan<\/h2>\n<p>\u307e\u305a\u306fexplain\u306e\u7d50\u679c\u304b\u3089<\/p>\n<pre class=\"lang:sql decode:true\">=# explain select * from users where login = 'example_id';\r\n                                   QUERY PLAN\r\n--------------------------------------------------------------------------------\r\n Index Scan using users_login_idx on users  (cost=0.00..27.96 rows=1 width=190)\r\n   Index Cond: ((login)::text = 'example_id'::text)<\/pre>\n<p>\u30b3\u30b9\u30c8\u306e\u90e8\u5206\u3092\u898b\u308b\u3068Seq Scan\u3068\u304f\u3089\u3079\u3066\u968f\u5206\u5c11\u306a\u3044\u5024\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u306a\u3093\u304b\u901f\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n<ul>\n<ol>Index\u306fIndex\u60c5\u5831\u3092\u30c4\u30ea\u30fc\u4e0a\u306b\u683c\u7d0d\u3057\u3066\u3044\u307e\u3059\u3002<\/ol>\n<ol>\u691c\u7d22\u6761\u4ef6\u306b\u5408\u3046\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u3042\u308c\u3070\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u63a2\u7d22\u3057\u307e\u3059\u3002<\/ol>\n<ol>\u5bfe\u8c61\u306e\u30c7\u30fc\u30bf\u304c\u898b\u3064\u304b\u308c\u3070\u3001\u8a72\u5f53\u306e\u884c\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u30c7\u30fc\u30bf\u3092\u8fd4\u3057\u307e\u3059\u3002<\/ol>\n<\/ul>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-2.png\" rel=\"facebox\" rel=\"attachment wp-att-2714\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-2714\" alt=\"postgresql-techscore-blog3-2\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-2.png\" width=\"300\" height=\"95\" \/><\/a><\/p>\n<p>\u30c7\u30fc\u30bf\u91cf\u304c\u591a\u3044\u6642\u306fIndex Scan\u306f\u304b\u306a\u308a\u6709\u52b9\u306a\u306e\u3067\u3059\u304c\u3001\u5c11\u306a\u3044\u6642\u306fSeq Scan\u306e\u65b9\u304c\u901f\u304b\u3063\u305f\u308a\u3057\u307e\u3059\u3002<br \/>\nPostgreSQL\u306e\u30aa\u30d7\u30c6\u30a3\u30de\u30a4\u30b6\u304c\u305d\u3053\u3089\u8fba\u3092\u8003\u3048\u3066\u72b6\u6cc1\u306b\u5fdc\u3058\u3066Index Scan\u3092\u4f7f\u3046\u304bSeq Scan\u3092\u4f7f\u3046\u304b\u3092\u5224\u65ad\u3057\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u3001Index Scan\u306f\u30c7\u30fc\u30bf\u91cf\u304c\u591a\u3044\u6642\u306b\u6709\u52b9\u306a\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u306f\u53c2\u7167\u306e\u6642\u3067\u3059\u3002<br \/>\nInsert\u3067\u30c7\u30fc\u30bf\u304c\u633f\u5165\u3055\u308c\u308b\u5834\u5408\u306f\u9045\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\nIndex\u304c\u3042\u308b\u30c6\u30fc\u30d6\u30eb\u306b\u306fIndex\u60c5\u5831\u3082\u66f4\u65b0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001Insert\u51e6\u7406\u304c\u9045\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u3068\u306f\u8a00\u3063\u3066\u3082\u30011\u4ef6\u306eInsert\u3050\u3089\u3044\u3067\u306f\u3042\u307e\u308a\u5909\u308f\u308a\u307e\u305b\u3093\u304c\u3001100\u4e07\u4ef6Insert\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u304b\u306a\u308a\u30b3\u30b9\u30c8\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n<p>\u5bfe\u8c61\u30c7\u30fc\u30bf\u306e\u53d6\u8fbc\u306f\u4ee5\u524d\u306b\u66f8\u3044\u305f\u306e\u3067\u305d\u3061\u3089\u3092\u898b\u3066\u4e0b\u3055\u3044\u3002<br \/>\n<a title=\"\u5927\u91cf\u30c7\u30fc\u30bf\u53d6\u8fbc\u306e\u3044\u308d\u3044\u308d-postgresql\u7de8\" href=\"http:\/\/www.techscore.com\/blog\/2012\/12\/14\/%E5%A4%A7%E9%87%8F%E3%83%87%E3%83%BC%E3%82%BF%E5%8F%96%E8%BE%BC%E3%81%AE%E3%81%84%E3%82%8D%E3%81%84%E3%82%8D-postgresql%E7%B7%A8\/\">\u5927\u91cf\u30c7\u30fc\u30bf\u53d6\u8fbc\u306e\u3044\u308d\u3044\u308d-postgresql\u7de8<\/a><\/p>\n<h2>Nested Loop<\/h2>\n<p>\u7d9a\u3044\u3066\u7d50\u5408\u7cfb\u3067\u3059\u3002<\/p>\n<p>\u307e\u305a\u306fNested Loop\u304b\u3089\u3067\u3059\u3002<\/p>\n<ul>\n<ol>Nested Loop\u306f\u5358\u7d14\u306a\u7d50\u5408\u65b9\u5f0f\u3067\u3059\u3002<\/ol>\n<ol>\u5916\u5074\u306e\u30c6\u30fc\u30d6\u30eb\u4e00\u884c\u3054\u3068\u306b\u5185\u5074\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u8d70\u67fb\u3057\u307e\u3059\u3002<\/ol>\n<ol>\u5916\u5074\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u4ef6\u6570\u304c\u5c11\u306a\u304f\u3001\u304b\u3064\u3001\u5185\u5074\u30c6\u30fc\u30d6\u30eb\u306b\u7d50\u5408\u30ad\u30fc\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u3042\u308b\u5834\u5408\u306b\u6709\u52b9\u3067\u3059\u3002<\/ol>\n<\/ul>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-3.png\" rel=\"facebox\" rel=\"attachment wp-att-2722\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-2722\" alt=\"postgresql-techscore-blog3-3\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-3.png\" width=\"300\" height=\"112\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-3.png 800w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-3-300x112.png 300w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u56f3\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u306a\u3044\u5834\u5408\u306e\u56f3\u3067\u3059\u3002<br \/>\n\u5185\u5074\u30c6\u30fc\u30d6\u30eb\u3092Seq Scan\u3059\u308b\u306e\u3067\u9045\u3044\u3067\u3059\u3002<br \/>\n\u30c6\u30fc\u30d6\u30eb\u306e\u30b5\u30a4\u30ba\u304c\u5927\u304d\u304f\u306a\u308c\u3070\u30b3\u30b9\u30c8\u306f\u81a8\u3089\u307f\u307e\u3059 \u21d2 \u8a08\u7b97\u91cf\u306fO(N\u00d7M)<\/p>\n<p>\u7d50\u5408\u30ad\u30fc\u3067Index\u304c\u3042\u308b\u5834\u5408\u306f\u3001\u5185\u5074\u30c6\u30fc\u30d6\u30eb\u306e\u691c\u7d22\u6642\u306fIndex Scan\u3068\u306a\u308a\u9ad8\u901f\u5316\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>EXPLAIN\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<pre class=\"lang:sql decode:true\">=# explain select * from regt_users as u join addresses as a on u.address_id = a.address_id;\r\n                                   QUERY PLAN\r\n---------------------------------------------------------------------------------------------------------------------\r\n Nested Loop  (cost=0.00..30878348.84 rows=129415 width=138)\r\n   Join Filter: (u.address_id = a.address_id)\r\n   -&gt;  Seq Scan on regt_users u  (cost=0.00..252.00 rows=10000 width=88)\r\n   -&gt;  Materialize  (cost=0.00..5576.40 rows=124627 width=50)\r\n         -&gt;  Seq Scan on addresses a  (cost=0.00..3735.27 rows=124627 width=50)<\/pre>\n<h2>Merge Join<\/h2>\n<p>\u6b21\u306fMerge Join\u3067\u3059\u3002<\/p>\n<ul>\n<ol>Merge Join\u306f\u7d50\u5408\u30ad\u30fc\u3067\u30bd\u30fc\u30c8\u3057\u3001\u30de\u30c3\u30c1\u30f3\u30b0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/ol>\n<ol>\u5916\u5074\u306e\u30c6\u30fc\u30d6\u30eb\u306f1\u56de\u8abf\u3079\u308c\u3070\u826f\u304f\u3001\u8d70\u67fb\u56de\u6570\u304c\u6e1b\u308a\u307e\u3059\u3002<\/ol>\n<ol>\u51e6\u7406\u5bfe\u8c61\u306e\u884c\u304c\u591a\u3044\u30b1\u30fc\u30b9\u306b\u6709\u52b9\u3067\u3059\u3002<\/ol>\n<\/ul>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-4.png\" rel=\"facebox\" rel=\"attachment wp-att-2730\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-2730\" alt=\"postgresql-techscore-blog3-4\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-4.png\" width=\"300\" height=\"89\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-4.png 1012w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-4-300x89.png 300w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u30bd\u30fc\u30c8\u3055\u3048\u51fa\u6765\u308c\u3070\u901f\u3044\u3051\u3069\u3001\u30bd\u30fc\u30c8\u304c\u9045\u3044\u3068\u4f59\u308a\u6709\u52b9\u3067\u306f\u306a\u3044\u3067\u3059\u3002<br \/>\nMerge Join\u3082\u7d50\u5408\u30ad\u30fc\u3067\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3092\u4f5c\u6210\u3059\u308c\u3070\u3001\u901f\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u7d50\u8ad6\u3068\u3057\u3066\u3001\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u91cd\u8981\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n<p>EXPLAIN\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<pre class=\"lang:sql decode:true\">=# explain select * from regt_users as u join addresses as a on u.address_id = a.address_id;\r\n                                     QUERY PLAN\r\n---------------------------------------------------------------------------------------------------------------------\r\n Merge Join  (cost=19517.82..20300.26 rows=10000 width=138)\r\n   Merge Cond: (a.address_id = u.address_id)\r\n   -&gt;  Sort  (cost=18121.88..18425.68 rows=121523 width=50)\r\n         Sort Key: a.address_id\r\n         -&gt;  Seq Scan on addresses a  (cost=0.00..3704.23 rows=121523 width=50)\r\n   -&gt;  Materialize  (cost=1395.89..1445.89 rows=10000 width=88)\r\n         -&gt;  Sort  (cost=1395.89..1420.89 rows=10000 width=88)\r\n               Sort Key: u.address_id\r\n               -&gt;  Seq Scan on regt_users u  (cost=0.00..252.00 rows=10000 width=88)<\/pre>\n<h2>Hash Join<\/h2>\n<p>\u7d9a\u3044\u3066Hash Join\u3067\u3059\u3002<\/p>\n<ul>\n<ol>Merge Join\u306f\u5185\u5074\u306e\u30c6\u30fc\u30d6\u30eb\u306e\u30cf\u30c3\u30b7\u30e5\u8868\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/ol>\n<ol>\u5916\u5074\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u30cf\u30c3\u30b7\u30e5\u8868\u3068\u4ed8\u304d\u3042\u308f\u305b\u3066\u7d50\u5408\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/ol>\n<ol>\u30cf\u30c3\u30b7\u30e5\u8868\u306f\u30e1\u30e2\u30ea\u306b\u4f5c\u308b\u306e\u3067\u3001\u4e00\u5ea6\u4f5c\u3063\u3066\u3057\u307e\u3048\u3070\u9ad8\u901f\u3067\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/ol>\n<\/ul>\n<p><a href=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-5.png\" rel=\"facebox\" rel=\"attachment wp-att-2733\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-2733\" alt=\"postgresql-techscore-blog3-5\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-5.png\" width=\"300\" height=\"114\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-5.png 786w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2013\/06\/postgresql-techscore-blog3-5-300x114.png 300w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u30cf\u30c3\u30b7\u30e5\u306f\u30e1\u30e2\u30ea\u306b\u4f5c\u3089\u308c\u308b\u306e\u3067\u901f\u3044\u306e\u3067\u3059\u304c\u3001\u30cf\u30c3\u30b7\u30e5\u8868\u306e\u30b5\u30a4\u30ba\u304c\u30e1\u30e2\u30ea\u30b5\u30a4\u30ba\u3088\u308a\u5927\u304d\u304f\u306a\u308c\u3070\u304b\u306a\u308a\u9045\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>EXPLAIN\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<pre class=\"lang:sql decode:true\">=# explain select * from regt_users as u join addresses as a on u.address_id = a.address_id;\r\n                                   QUERY PLAN\r\n--------------------------------------------------------------------------------\r\n Hash Join  (cost=6410.27..8298.27 rows=10000 width=138)\r\n   Hash Cond: (u.address_id = a.address_id)\r\n   -&gt;  Seq Scan on regt_users u  (cost=0.00..252.00 rows=10000 width=88)\r\n   -&gt;  Hash  (cost=3704.23..3704.23 rows=121523 width=50)\r\n         -&gt;  Seq Scan on addresses a  (cost=0.00..3704.23 rows=121523 width=50)<\/pre>\n<h2>\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u306e\u7121\u52b9\u5316<\/h2>\n<p>\u4e0a\u8a18\u306b\u3042\u308b\u7d50\u5408\u7cfb\u306eEXPLAIN\u3067\u3059\u304c\u3001\u3059\u3079\u3066\u540c\u3058SQL\u3067\u3059\u3002<br \/>\n\u3067\u3082\u3001\u7570\u306a\u308b\u5b9f\u884c\u8a08\u753b\u3092\u4f7f\u3063\u3066\u307e\u3059\u3002<br \/>\n\u306a\u305c\u304b\uff01\uff1f<\/p>\n<p>\u5b9f\u306f\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u3092\u7121\u52b9\u306b\u3059\u308b\u9b54\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u305d\u3046\u3057\u306a\u3044\u3068\u3001\u5168\u90e8Hash Join\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3002\u3002\u3002<\/p>\n<pre class=\"lang:sql decode:true\">set ENABLE_MERGEJOIN to off; -- Merge Join \u3092\u7121\u52b9\u306b\r\nset ENABLE_HASHJOIN to off; -- Hash Join \u3092\u7121\u52b9\u306b\r\n\r\nset ENABLE_MERGEJOIN to on; -- Merge Join \u3092\u6709\u52b9\u306b\r\nset ENABLE_HASHJOIN to on; -- Hash Join \u3092\u6709\u52b9\u306b<\/pre>\n<p>\u3053\u3046\u3059\u308c\u3070\u3001\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u3092\u5236\u5fa1\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b7\u30b9\u30c6\u30e0\u306e\u904b\u7528\u4e2d\u306b\u3059\u308b\u3053\u3068\u306f\u63a8\u5968\u3067\u304d\u307e\u305b\u3093\u304c\u3001\u3053\u306e\u5b9f\u884c\u8a08\u753b\u3067\u3044\u3044\u306e\uff01\uff1f<br \/>\n\u3063\u3066\u6642\u306b\u8abf\u3079\u308b\u306b\u306f\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306f\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u306b\u3064\u3044\u3066\u3067\u3057\u305f\u3002<br \/>\n\u3082\u3046\u304a\u6c17\u3065\u304d\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u300cIndex Only Scan\u300d\u306f\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50\u306e1\u3064\u3067\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u6b21\u56de\u306fIndex Only Scan\u306b\u3064\u3044\u3066\u3067\u3059\u3002<\/p>\n<p>\u8ffd\u8a18\u578b\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3<br \/>\n\u30d0\u30ad\u30e5\u30fc\u30e0<br \/>\nVisibility Map<br \/>\n\u30d7\u30e9\u30f3\u6f14\u7b97\u5b50 \u2190 \u30a4\u30de\u30b3\u30b3<br \/>\nIndex Only Scan \u2190 \u30c4\u30ae\u30b3\u30b3<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3046\u3082\u3002\u6751\u4e0a\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u30673\u56de\u76ee\u306ePostgreSQL\u3067\u3059\u3002<\/p>\n<p>\u4eca\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2013\/06\/07\/postgresql-index-only-scan-%e5%a5%ae%e9%97%98%e8%a8%98-%e3%81%9d%e3%81%ae3\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[97],"tags":[206],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2698"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=2698"}],"version-history":[{"count":1,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2698\/revisions"}],"predecessor-version":[{"id":17929,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/2698\/revisions\/17929"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=2698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=2698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=2698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}