{"id":4935,"date":"2018-04-03T19:31:02","date_gmt":"2018-04-04T02:31:02","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=4935"},"modified":"2025-06-13T23:43:08","modified_gmt":"2025-06-14T06:43:08","slug":"understanding-index-grouping-aggregation-couchbase-n1ql-query","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/ko\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/","title":{"rendered":"Couchbase N1QL \ucffc\ub9ac\uc5d0\uc11c \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4 \uc774\ud574\ud558\uae30"},"content":{"rendered":"<p><a href=\"https:\/\/www.couchbase.com\/blog\/ko\/\"><span style=\"font-weight: 400\">\uce74\uc6b0\uce58\ubca0\uc774\uc2a4<\/span><\/a> <a href=\"https:\/\/docs.couchbase.com\/server\/5.5\/n1ql\/n1ql-language-reference\/index.html\"><span style=\"font-weight: 400\">N1QL<\/span><\/a><span style=\"font-weight: 400\"> \uc740 \uc720\uc5f0\ud55c \ub370\uc774\ud130 \ubaa8\ub378\uc744 \ud1b5\ud574 \ubd84\uc0b0 \ub370\uc774\ud130\uc758 \uc778\ub371\uc2a4\ubcc4\ub85c JSON\uc5d0 \ub300\ud55c \uc9d1\uacc4 SQL\uc744 \uc81c\uacf5\ud558\ub3c4\ub85d \uc124\uacc4\ub41c \ucd5c\uc2e0 \ucffc\ub9ac \ucc98\ub9ac \uc5d4\uc9c4\uc785\ub2c8\ub2e4. \ucd5c\uc2e0 \ub370\uc774\ud130\ubca0\uc774\uc2a4\ub294 \ub300\uaddc\ubaa8 \ud074\ub7ec\uc2a4\ud130\uc5d0 \ubc30\ud3ec\ub429\ub2c8\ub2e4. JSON\uc744 \uc0ac\uc6a9\ud558\uba74 \uc720\uc5f0\ud55c \ub370\uc774\ud130 \ubaa8\ub4dc\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4. N1QL\uc740 \ucffc\ub9ac \ucc98\ub9ac\ub97c \ub354 \uc27d\uac8c \ud558\uae30 \uc704\ud574 \ud5a5\uc0c1\ub41c JSON\uc6a9 \uc778\ub371\uc2a4\ubcc4 \uadf8\ub8f9 SQL\uc744 \uc9c0\uc6d0\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\uc560\ud50c\ub9ac\ucf00\uc774\uc158\uacfc \ub370\uc774\ud130\ubca0\uc774\uc2a4 \ub4dc\ub77c\uc774\ubc84\ub294 \ud074\ub7ec\uc2a4\ud130\uc5d0\uc11c \uc0ac\uc6a9 \uac00\ub2a5\ud55c \ucffc\ub9ac \ub178\ub4dc \uc911 \ud558\ub098\uc5d0 N1QL \ucffc\ub9ac\ub97c \uc81c\ucd9c\ud569\ub2c8\ub2e4. \ucffc\ub9ac \ub178\ub4dc\ub294 \ucffc\ub9ac\ub97c \ubd84\uc11d\ud558\uace0 \uae30\ubcf8 \uac1c\uccb4\uc5d0 \ub300\ud55c \uba54\ud0c0\ub370\uc774\ud130\ub97c \uc0ac\uc6a9\ud558\uc5ec \ucd5c\uc801\uc758 \uc2e4\ud589 \uacc4\ud68d\uc744 \ud30c\uc545\ud55c \ub2e4\uc74c \uc2e4\ud589\ud569\ub2c8\ub2e4. \uc2e4\ud589 \uc911\uc5d0 \ucffc\ub9ac\uc5d0 \ub530\ub77c \ud574\ub2f9 \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud558\uc5ec \ucffc\ub9ac \ub178\ub4dc\ub294 \uc778\ub371\uc2a4 \ubc0f \ub370\uc774\ud130 \ub178\ub4dc\uc640 \ud568\uaed8 \uc791\ub3d9\ud558\uc5ec \ub370\uc774\ud130\ub97c \uac80\uc0c9\ud558\uace0 \uacc4\ud68d\ub41c \uc791\uc5c5\uc744 \uc218\ud589\ud569\ub2c8\ub2e4. Couchbase\ub294 \ubaa8\ub4c8\uc2dd \ud074\ub7ec\uc2a4\ud130\ud615 \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc774\ubbc0\ub85c \uc131\ub2a5 \ubc0f \uac00\uc6a9\uc131 \ubaa9\ud45c\uc5d0 \ub9de\uac8c \ub370\uc774\ud130, \uc778\ub371\uc2a4, \ucffc\ub9ac \uc11c\ube44\uc2a4\ub97c \ud655\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Couchbase 5.5 \uc774\uc804\uc5d0\ub294 GROUP BY \ubc0f\/\ub610\ub294 \uc9d1\uacc4\uac00 \ud3ec\ud568\ub41c \ucffc\ub9ac\uac00 \uc778\ub371\uc2a4\uc5d0 \ud3ec\ud568\ub418\ub294 \uacbd\uc6b0\uc5d0\ub3c4 \ucffc\ub9ac\uac00 \uc778\ub371\uc11c\uc5d0\uc11c \ubaa8\ub4e0 \uad00\ub828 \ub370\uc774\ud130\ub97c \uac00\uc838\uc640 \ucffc\ub9ac \uc5d4\uc9c4 \ub0b4\uc5d0\uc11c \ub370\uc774\ud130\uc758 \uadf8\ub8f9\ud654\/\uc9d1\uacc4\ub97c \uc218\ud589\ud588\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4941 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM-300x169.png\" alt=\"\" width=\"772\" height=\"435\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM-300x169.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM-1024x578.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM-768x433.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM-1536x867.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM-20x11.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM-1320x745.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.48-PM.png 1666w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\ubc94\uc704 \uc2a4\uce94 \uc678\uc5d0\ub3c4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc218\ud589\ud558\ub3c4\ub85d \uc778\ub371\uc11c\uc5d0\uac8c \uc9c0\ub2a5\uc801\uc73c\ub85c \uc694\uccad\ud558\ub3c4\ub85d \uac1c\uc120\ub41c Couchbase 5.5 \ucffc\ub9ac \ud50c\ub798\ub108 <\/span><b>\uc778\ub371\uc2a4 \ucee4\ubc84\ub9c1\uc6a9<\/b><span style=\"font-weight: 400\">. \uc778\ub371\uc11c\uac00 \uadf8\ub8f9\ud654, \uce74\uc6b4\ud2b8(), \ud569\uacc4(), \ucd5c\uc18c(), \ucd5c\ub300(), \ud3c9\uade0() \ubc0f \uad00\ub828 \uc5f0\uc0b0\uc744 \uc989\uc2dc \uc218\ud589\ud560 \uc218 \uc788\ub3c4\ub85d \uac1c\uc120\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \u00a0<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4940 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM-300x164.png\" alt=\"\" width=\"782\" height=\"427\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM-300x164.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM-1024x559.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM-768x419.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM-1536x838.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM-20x11.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM-1320x720.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-3.46.59-PM.png 1682w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\uc774\ub97c \uc704\ud574\uc11c\ub294 \uc0ac\uc6a9\uc790 \ucffc\ub9ac\ub97c \ubcc0\uacbd\ud560 \ud544\uc694\ub294 \uc5c6\uc9c0\ub9cc \ucffc\ub9ac\ub97c \ucee4\ubc84\ud558\uace0 \uc778\ub371\uc2a4 \ud0a4\ub97c \uc815\ub82c\ud560 \uc218 \uc788\ub294 \uc88b\uc740 \uc778\ub371\uc2a4 \uc124\uacc4\uac00 \ud544\uc694\ud569\ub2c8\ub2e4.  \ubaa8\ub4e0 \ucffc\ub9ac\uac00 \uc774 \ucd5c\uc801\ud654\uc758 \ud61c\ud0dd\uc744 \ubc1b\ub294 \uac83\uc740 \uc544\ub2c8\uba70, \ubaa8\ub4e0 \uc778\ub371\uc2a4\uac00 \ubaa8\ub4e0 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4 \uc791\uc5c5\uc744 \uac00\uc18d\ud654\ud560 \uc218 \uc788\ub294 \uac83\ub3c4 \uc544\ub2d9\ub2c8\ub2e4. \uc62c\ubc14\ub978 \ud328\ud134\uc744 \uc774\ud574\ud558\uba74 \uc778\ub371\uc2a4\uc640 \ucffc\ub9ac\ub97c \uc124\uacc4\ud558\ub294 \ub370 \ub3c4\uc6c0\uc774 \ub429\ub2c8\ub2e4. \uae00\ub85c\ubc8c \ubcf4\uc870 \uc778\ub371\uc2a4\uc5d0 \ub300\ud55c \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub294 \ub450 \uc2a4\ud1a0\ub9ac\uc9c0 \uc5d4\uc9c4 \ubaa8\ub450\uc5d0\uc11c \uc9c0\uc6d0\ub429\ub2c8\ub2e4: \ud45c\uc900 GSI\uc640 \uba54\ubaa8\ub9ac \ucd5c\uc801\ud654 GSI(MOI). \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub294 Enterprise Edition\uc5d0\uc11c\ub9cc \uc9c0\uc6d0\ub429\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\uc778\ub371\uc11c\uc5d0 \uc758\ud574 GROUP BY \ubc0f \uc9d1\uacc4\uac00 \uc218\ud589\ub418\ub294 \uc774 \uac10\uc18c \ub2e8\uacc4\ub294 \ub370\uc774\ud130 \uc804\uc1a1 \ubc0f \ub514\uc2a4\ud06c I\/O\uc758 \uc591\uc744 \uc904\uc5ec\uc90d\ub2c8\ub2e4:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac \uc751\ub2f5 \uc2dc\uac04 \uac1c\uc120<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ub9ac\uc18c\uc2a4 \ud65c\uc6a9\ub3c4 \ud5a5\uc0c1<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc9e7\uc740 \uc9c0\uc5f0 \uc2dc\uac04<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ub192\uc740 \ud655\uc7a5\uc131<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ub0ae\uc740 \ucd1d \uc18c\uc720 \ube44\uc6a9<\/span><\/li>\n<\/ul>\n<h2><b>\uc131\ub2a5<\/b><\/h2>\n<p><span style=\"font-weight: 400\">\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub294 \ucffc\ub9ac \uc131\ub2a5\uc744 \ud06c\uac8c \uac1c\uc120\ud558\uace0 \uc9c0\uc5f0 \uc2dc\uac04\uc744 \ud06c\uac8c \uc904\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub2e4\uc74c \ud45c\uc5d0\ub294 \uba87 \uac00\uc9c0 \ucffc\ub9ac \uc9c0\uc5f0 \uc2dc\uac04 \uce21\uc815 \uc0d8\ud50c\uc774 \ub098\uc640 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\uc0c9\uc778 :<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">CREATE INDEX idx_ts_type_country_city ON `travel-sample` (type, country, city);<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"responsive-table\">\n<table style=\"height: 1284px\" width=\"1025\">\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">\ucffc\ub9ac<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc124\uba85<\/span><\/td>\n<td><span style=\"font-weight: 400\">5.0 \uc9c0\uc5f0 \uc2dc\uac04 <\/span><\/td>\n<td><span style=\"font-weight: 400\">5.5 \uc9c0\uc5f0 \uc2dc\uac04<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SELECT t.type, COUNT(type) AS cnt\u00a0<\/span><span style=\"font-weight: 400\">FROM `travel-sample` AS t <\/span><span style=\"font-weight: 400\">\uc5ec\uae30\uc11c t.type\uc774 NULL\uc774 \uc544\ub2cc \uacbd\uc6b0 <\/span><span style=\"font-weight: 400\">GROUP BY t.type;<\/span><\/td>\n<td>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\ub85c \uadf8\ub8f9\ud654 <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc9d1\uacc4 <\/span><\/li>\n<\/ul>\n<\/td>\n<td><span style=\"font-weight: 400\">230ms<\/span><\/td>\n<td><span style=\"font-weight: 400\">13ms<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SELECT t.type, COUNT(1) AS cnt, <\/span><span style=\"font-weight: 400\">COUNT(DISTINCT city) AS cntdcity <\/span><span style=\"font-weight: 400\">FROM `travel-sample` AS t <\/span><span style=\"font-weight: 400\">WHERE t.type IN [\"hotel\",\"airport\"] <\/span><span style=\"font-weight: 400\">GROUP BY t.type, t.country;<\/span><\/td>\n<td>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc5ec\ub7ec \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\ub85c \uadf8\ub8f9\ud654<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ub2e4\uc911 \uc9d1\uacc4<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uace0\uc720 \uc9d1\uacc4<\/span><\/li>\n<\/ul>\n<\/td>\n<td><span style=\"font-weight: 400\">40ms<\/span><\/td>\n<td><span style=\"font-weight: 400\">7ms<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SELECT t.country, COUNT(city) AS cnt <\/span><span style=\"font-weight: 400\">FROM `travel-sample` AS t\u00a0<\/span><span style=\"font-weight: 400\">\uc5b4\ub514 <\/span><b>t.type = \"airport\" <\/b><span style=\"font-weight: 400\">\uad6d\uac00\ubcc4\ub85c \uadf8\ub8f9\ud654;<\/span><\/td>\n<td>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uccab \ubc88\uc9f8 \ube44\ud3c9\ub4f1 \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4 \uae30\uc900\uc73c\ub85c \uadf8\ub8f9\ud654<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc9d1\uacc4<\/span><\/li>\n<\/ul>\n<\/td>\n<td><span style=\"font-weight: 400\">25ms<\/span><\/td>\n<td><span style=\"font-weight: 400\">3ms<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SELECT t.city, cnt <\/span><span style=\"font-weight: 400\">FROM `travel-sample` AS t <\/span><span style=\"font-weight: 400\">\uc5ec\uae30\uc11c t.type\uc774 NULL\uc774 \uc544\ub2cc \uacbd\uc6b0 <\/span><span style=\"font-weight: 400\">t.city \uae30\uc900 \uadf8\ub8f9\ud654 <\/span><span style=\"font-weight: 400\">cnt = COUNT(city) <\/span><span style=\"font-weight: 400\">cnt &gt; 0 \uc778 \uacbd\uc6b0 ;<\/span><\/td>\n<td>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ube44\uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\ub85c \uadf8\ub8f9\ud654<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ud5c8\uc6a9 \uc870\ud56d<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">HAVING \uc808<\/span><\/li>\n<\/ul>\n<\/td>\n<td><span style=\"font-weight: 400\">300ms<\/span><\/td>\n<td><span style=\"font-weight: 400\">160ms<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2><b>\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4 \uac1c\uc694<\/b><\/h2>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4938 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM-300x161.png\" alt=\"\" width=\"861\" height=\"462\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM-300x161.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM-1024x549.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM-768x412.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM-20x11.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM-1320x708.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png 1388w\" sizes=\"auto, (max-width: 861px) 100vw, 861px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">\uc704 \uadf8\ub9bc\uc740 SELECT \ucffc\ub9ac\uac00 \uacb0\uacfc\ub97c \ubc18\ud658\ud558\uae30 \uc704\ud574 \uac70\uce58\ub294 \ubaa8\ub4e0 \uac00\ub2a5\ud55c \ub2e8\uacc4\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. <\/span><span style=\"font-weight: 400\">\u00a0<\/span><span style=\"font-weight: 400\">\ud544\ud130\ub9c1 \ud504\ub85c\uc138\uc2a4\ub294 \ucd08\uae30 \ud0a4\uc2a4\ud398\uc774\uc2a4\ub97c \uac00\uc838\uc640 \ucffc\ub9ac\uac00 \uad00\uc2ec \uc788\ub294 \ubb38\uc11c\uc758 \ucd5c\uc801 \ud558\uc704 \uc9d1\ud569\uc744 \uc0dd\uc131\ud569\ub2c8\ub2e4. \uac00\ub2a5\ud55c \ud55c \uac00\uc7a5 \uc791\uc740 \ud558\uc704 \uc9d1\ud569\uc744 \uc0dd\uc131\ud558\uae30 \uc704\ud574 \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud558\uc5ec \uac00\ub2a5\ud55c \ud55c \ub9ce\uc740 \uc220\uc5b4\ub97c \uc801\uc6a9\ud569\ub2c8\ub2e4. \ucffc\ub9ac \uc220\uc5b4\ub294 \uad00\uc2ec \uc788\ub294 \ub370\uc774\ud130\uc758 \ud558\uc704 \uc9d1\ud569\uc744 \ub098\ud0c0\ub0c5\ub2c8\ub2e4. \ucffc\ub9ac \uacc4\ud68d \ub2e8\uacc4\uc5d0\uc11c \uc0ac\uc6a9\ud560 \uc778\ub371\uc2a4\ub97c \uc120\ud0dd\ud569\ub2c8\ub2e4. \uadf8\ub7f0 \ub2e4\uc74c \uac01 \uc778\ub371\uc2a4\uc5d0 \ub300\ud574 \uac01 \uc778\ub371\uc2a4\uac00 \uc801\uc6a9\ud560 \uc220\uc5b4\ub97c \uacb0\uc815\ud569\ub2c8\ub2e4. \ucffc\ub9ac \uc220\uc5b4\ub294 \ucffc\ub9ac \uacc4\ud68d\uc5d0\uc11c \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \ubcc0\ud658\ub418\uc5b4 \uc778\ub371\uc11c\uc5d0\uac8c \uc804\ub2ec\ub429\ub2c8\ub2e4. <\/span><\/p>\n<p><span style=\"font-weight: 400\">\ucffc\ub9ac\uc5d0 JOIN\uc774 \uc5c6\uace0 \uc778\ub371\uc2a4\uc5d0 \ud3ec\ud568\ub418\ub294 \uacbd\uc6b0 \uac00\uc838\uc624\uae30 \ubc0f \uc870\uc778 \ub2e8\uacc4\ub97c \ubaa8\ub450 \uc81c\uac70\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4937 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.20-AM-300x162.png\" alt=\"\" width=\"839\" height=\"453\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.20-AM-300x162.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.20-AM-1024x552.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.20-AM-768x414.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.20-AM-20x11.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.20-AM-1320x711.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.20-AM.png 1366w\" sizes=\"auto, (max-width: 839px) 100vw, 839px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">\ubaa8\ub4e0 \uc220\uc5b4\uac00 \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \uc815\ud655\ud788 \ubcc0\ud658\ub418\uba74 \ud544\ud130 \ub2e8\uacc4\ub3c4 \uc81c\uac70\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774 \uc0c1\ud669\uc5d0\uc11c\ub294 \uc2a4\uce94\uacfc \uc9d1\uacc4\uac00 \ub098\ub780\ud788 \uc788\uc73c\uba70, \uc778\ub371\uc11c\uc5d0\ub294 \uc9d1\uacc4 \uae30\ub2a5\uc774 \uc788\uc73c\ubbc0\ub85c \ud574\ub2f9 \ub2e8\uacc4\ub294 \uc778\ub371\uc11c \ub178\ub4dc\uc5d0\uc11c \uc218\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uacbd\uc6b0\uc5d0 \ub530\ub77c \uc815\ub82c, \uc624\ud504\uc14b, \uc81c\ud55c \ub2e8\uacc4\ub3c4 \uc778\ub371\uc11c \ub178\ub4dc\uc5d0\uc11c \uc218\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4936 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.31-AM-300x163.png\" alt=\"\" width=\"837\" height=\"455\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.31-AM-300x163.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.31-AM-1024x556.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.31-AM-768x417.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.31-AM-20x11.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.31-AM-1320x716.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-11.29.31-AM.png 1356w\" sizes=\"auto, (max-width: 837px) 100vw, 837px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">\ub2e4\uc74c \ud750\ub984\ub3c4\ub294 \ucffc\ub9ac \ud50c\ub798\ub108\uac00 \ucffc\ub9ac\uc758 \uac01 \ucffc\ub9ac \ube14\ub85d\uc5d0 \ub300\ud574 \uc778\ub371\uc2a4 \uc9d1\uacc4\ub97c \uc218\ud589\ud558\uae30\ub85c \uacb0\uc815\ud558\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud569\ub2c8\ub2e4. \uc778\ub371\uc2a4 \uc9d1\uacc4\uac00 \ubd88\uac00\ub2a5\ud55c \uacbd\uc6b0 \ucffc\ub9ac \uc5d4\uc9c4\uc5d0\uc11c \uc9d1\uacc4\uac00 \uc218\ud589\ub429\ub2c8\ub2e4.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4943 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-4.01.01-PM-300x234.png\" alt=\"\" width=\"944\" height=\"736\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-4.01.01-PM-300x234.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-4.01.01-PM-768x600.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-4.01.01-PM-20x16.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-4.01.01-PM-1320x1031.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-4.01.01-PM.png 1388w\" sizes=\"auto, (max-width: 944px) 100vw, 944px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">For example, let&#8217;s compare the previous vs. current performance of using GROUP BY and examine the EXPLAIN plan of the following query that uses an index defined on the Couchbase `travel-sample` bucket:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">CREATE INDEX `def_type` ON `travel-sample`(`type`);\r\n<\/pre>\n<p><span style=\"font-weight: 400\">\ucffc\ub9ac\ub97c \uc0dd\uac01\ud574 \ubcf4\uc138\uc694: <\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">SELECT type, COUNT(type)\r\nFROM `travel-sample`\r\nWHERE type IS NOT MISSING\r\nGROUP BY type;<\/pre>\n<p><span style=\"font-weight: 400\">Couchbase \ubc84\uc804 5.5 \uc774\uc804\uc5d0\ub294 \uc774 \ucffc\ub9ac \uc5d4\uc9c4\uc774 \uc778\ub371\uc11c\uc5d0\uc11c \uad00\ub828 \ub370\uc774\ud130\ub97c \uac00\uc838\uc624\uace0 \ub370\uc774\ud130\uc758 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub294 \ucffc\ub9ac \uc5d4\uc9c4 \ub0b4\uc5d0\uc11c \uc218\ud589\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uc774 \uac04\ub2e8\ud55c \ucffc\ub9ac\ub294 \uc57d 250ms\uac00 \uc18c\uc694\ub429\ub2c8\ub2e4.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4939 alignnone\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM-300x47.png\" alt=\"\" width=\"848\" height=\"133\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM-300x47.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM-1024x160.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM-768x120.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM-1536x240.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM-20x3.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM-1320x206.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-02-at-7.39.06-PM.png 1690w\" sizes=\"auto, (max-width: 848px) 100vw, 848px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\uc774\uc81c Couchbase \ubc84\uc804 5.5\uc5d0\uc11c \uc774 \ucffc\ub9ac\ub294 \ub3d9\uc77c\ud55c def_type \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud558\uc9c0\ub9cc 20ms \uc774\ub0b4\uc5d0 \uc2e4\ud589\ub429\ub2c8\ub2e4. \uc544\ub798 \uc124\uba85\uc5d0\uc11c \uc778\ub371\uc2a4 \uc2a4\uce94 \ub2e8\uacc4\uc5d0\uc11c \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub3c4 \uc218\ud589\ud558\uae30 \ub54c\ubb38\uc5d0 \ub2e8\uacc4 \uc218\uac00 \uc904\uc5b4\ub4e4\uace0 \uc778\ub371\uc2a4 \uc2a4\uce94 \ud6c4 \uadf8\ub8f9\ud654 \ub2e8\uacc4\uac00 \uc0dd\ub7b5\ub41c \uac83\uc744 \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4949 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.11-PM-300x36.png\" alt=\"\" width=\"850\" height=\"102\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.11-PM-300x36.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.11-PM-1024x124.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.11-PM-768x93.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.11-PM-20x2.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.11-PM-1320x159.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.11-PM.png 1524w\" sizes=\"auto, (max-width: 850px) 100vw, 850px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\ub370\uc774\ud130 \ubc0f \ucffc\ub9ac \ubcf5\uc7a1\uc131\uc774 \uc99d\uac00\ud568\uc5d0 \ub530\ub77c \uc131\ub2a5 \uc774\uc810(\uc9c0\uc5f0 \uc2dc\uac04 \ubc0f \ucc98\ub9ac\ub7c9 \ubaa8\ub450)\ub3c4 \uc99d\uac00\ud569\ub2c8\ub2e4. \u00a0\u00a0<\/span><\/p>\n<h2><b>\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\uc5d0 \ub300\ud55c \uc124\uba85 \uc774\ud574<\/b><\/h2>\n<p><span style=\"font-weight: 400\">\ucffc\ub9ac\uc5d0 \ub300\ud55c \uc124\uba85\uc744 \uc0b4\ud3b4\ubd05\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">EXPLAIN SELECT type, COUNT(type) FROM `travel-sample` WHERE type IS NOT MISSING GROUP BY type;{<\/pre>\n<pre class=\"theme:github lang:mysql decode:true\">{\r\n  \"plan\": {\r\n    \"#operator\": \"Sequence\",\r\n    \"~children\": [\r\n      {\r\n        \"#operator\": \"IndexScan3\",\r\n        \"covers\": [\r\n          \"cover ((`travel-sample`.`type`))\",\r\n          \"cover ((meta(`travel-sample`).`id`))\",\r\n          \"cover (count(cover ((`travel-sample`.`type`))))\"\r\n        ],\r\n        \"index\": \"def_type\",\r\n        \"index_group_aggs\": {\r\n          \"aggregates\": [\r\n            {\r\n              \"aggregate\": \"COUNT\",\r\n              \"depends\": [\r\n                0\r\n              ],\r\n              \"expr\": \"cover ((`travel-sample`.`type`))\",\r\n              \"id\": 2,\r\n              \"keypos\": 0\r\n            }\r\n          ],\r\n          \"depends\": [\r\n            0\r\n          ],\r\n          \"group\": [\r\n            {\r\n              \"depends\": [\r\n                0\r\n              ],\r\n              \"expr\": \"cover ((`travel-sample`.`type`))\",\r\n              \"id\": 0,\r\n              \"keypos\": 0\r\n            }\r\n          ]\r\n        },\r\n        \"index_id\": \"b948c92b44c2739f\",\r\n        \"index_projection\": {\r\n          \"entry_keys\": [\r\n            0,\r\n            2\r\n          ]\r\n        },\r\n        \"keyspace\": \"travel-sample\",\r\n        \"namespace\": \"default\",\r\n        \"spans\": [\r\n          {\r\n            \"exact\": true,\r\n            \"range\": [\r\n              {\r\n                \"inclusion\": 1,\r\n                \"low\": \"null\"\r\n              }\r\n            ]\r\n          }\r\n        ],\r\n        \"using\": \"gsi\"\r\n      },\r\n      {\r\n        \"#operator\": \"Parallel\",\r\n        \"~child\": {\r\n          \"#operator\": \"Sequence\",\r\n          \"~children\": [\r\n            {\r\n              \"#operator\": \"InitialProject\",\r\n              \"result_terms\": [\r\n                {\r\n                  \"expr\": \"cover ((`travel-sample`.`type`))\"\r\n                },\r\n                {\r\n                  \"expr\": \"cover (count(cover ((`travel-sample`.`type`))))\"\r\n                }\r\n              ]\r\n            },\r\n            {\r\n              \"#operator\": \"FinalProject\"\r\n            }\r\n          ]\r\n        }\r\n      }\r\n    ]\r\n  },\r\n  \"text\": \"SELECT type, COUNT(type) FROM `travel-sample` WHERE type IS NOT MISSING GROUP BY type;\"\r\n}<\/pre>\n<p>\uc778\ub371\uc2a4 \uc2a4\uce94 \uc139\uc158\uc5d0 \"index_group_aggs\"\uac00 \ud45c\uc2dc\ub429\ub2c8\ub2e4(\uc608: \"#operator\": \"IndexScan3\"). \"index_group_aggs\"\uac00 \ub204\ub77d\ub41c \uacbd\uc6b0 \ucffc\ub9ac \uc11c\ube44\uc2a4\uac00 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc218\ud589 \uc911\uc785\ub2c8\ub2e4. \ud604\uc7ac \ucffc\ub9ac\uac00 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\uace0 \uc788\uace0 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\uc5d0 \ud544\uc694\ud55c \ubaa8\ub4e0 \uad00\ub828 \uc815\ubcf4 \uc778\ub371\uc11c\ub97c \uac00\uc9c0\uace0 \uc788\ub294 \uacbd\uc6b0. \ub2e4\uc74c \ud45c\ub294 index_group_aggs \uac1d\uccb4\uc758 \ub2e4\uc591\ud55c \uc815\ubcf4\ub97c \ud574\uc11d\ud558\ub294 \ubc29\ubc95\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n<div class=\"responsive-table\">\n<table>\n<tbody>\n<tr>\n<td><b>\ud544\ub4dc \uc774\ub984<\/b><\/td>\n<td><b>\uc124\uba85<\/b><\/td>\n<td><b>\uc608\uc81c\uc758 \ud68c\uc120 \ubc88\ud638<\/b><\/td>\n<td><b>\uc608\uc81c\uc5d0\uc11c \ud14d\uc2a4\ud2b8 \uc124\uba85\ud558\uae30<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">\uc9d1\uacc4<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc9d1\uacc4 \uac1c\uccb4\uc758 \ubc30\uc5f4\uc774\uba70 \uac01 \uac1c\uccb4\ub294 \ud558\ub098\uc758 \uc9d1\uacc4\ub97c \ub098\ud0c0\ub0c5\ub2c8\ub2e4. \uc774 \ud56d\ubaa9\uc774 \uc5c6\uc73c\uba74 \ucffc\ub9ac\uc5d0 \uadf8\ub8f9 \uae30\uc900\ub9cc \uc874\uc7ac\ud55c\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4.<\/span><\/td>\n<td><span style=\"font-weight: 400\">14-24<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc9d1\uacc4<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0\uc9d1\uacc4<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc9d1\uacc4 \uc791\uc5c5(<\/span><span style=\"font-weight: 400\">\ucd5c\ub300\/\ucd5c\uc18c\/\ud569\uacc4\/\uce74\uc6b4\ud2b8\/\uce74\uc6b4\ud2b8)<\/span><span style=\"font-weight: 400\">.<\/span><\/td>\n<td><span style=\"font-weight: 400\">16<\/span><\/td>\n<td><span style=\"font-weight: 400\">COUNT<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">distinct<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc9d1\uacc4 \uc218\uc815\uc790\ub294 DISTINCT\uc785\ub2c8\ub2e4.<\/span><\/td>\n<td><span style=\"font-weight: 400\">&#8211;<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uac70\uc9d3(\ucc38\uc77c \ub54c\ub9cc \ud45c\uc2dc)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0\uc758\uc874<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc9d1\uacc4 \ud45c\ud604\uc2dd\uc774 \uc758\uc874\ud558\ub294 \uc778\ub371\uc2a4 \ud0a4 \uc704\uce58(0\uc73c\ub85c \uc2dc\uc791) \ubaa9\ub85d\uc785\ub2c8\ub2e4.<\/span><\/td>\n<td><span style=\"font-weight: 400\">17-19<\/span><\/td>\n<td><span style=\"font-weight: 400\">0 <\/span><span style=\"font-weight: 400\">(\uc720\ud615\uc774 def_type \uc778\ub371\uc2a4\uc758 0\ubc88\uc9f8 \uc778\ub371\uc2a4 \ud0a4\uc774\ubbc0\ub85c)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0expr<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc9d1\uacc4 \ud45c\ud604\uc2dd<\/span><\/td>\n<td><span style=\"font-weight: 400\">20<\/span><\/td>\n<td><span style=\"font-weight: 400\">cover ((`travel-sample`.`type`))<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0id<\/span><\/td>\n<td><span style=\"font-weight: 400\">\ub0b4\ubd80\uc801\uc73c\ub85c \ubd80\uc5ec\ub41c \uace0\uc720 ID\ub85c \ub2e4\uc74c\uc5d0\uc11c \uc0ac\uc6a9\ub429\ub2c8\ub2e4. <\/span><span style=\"font-weight: 400\">index_projection<\/span><\/td>\n<td><span style=\"font-weight: 400\">21<\/span><\/td>\n<td><span style=\"font-weight: 400\">2<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0\ud0a4\ud3ec\uc2a4<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc778\ub371\uc2a4 \ud0a4 \uc704\uce58 \ub610\ub294 expr \ud544\ub4dc\uc5d0\uc11c \ud45c\ud604\uc2dd\uc744 \uc0ac\uc6a9\ud558\ub3c4\ub85d \uc9c0\uc2dc\ud558\ub294 \ud45c\uc2dc\uae30\uc785\ub2c8\ub2e4.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uac12\uc774 -1\ubcf4\ub2e4 \ud06c\uba74 \uc9d1\uacc4 \ud45c\ud604\uc2dd\uc774 \ud574\ub2f9 \uc778\ub371\uc2a4 \ud0a4 \uc704\uce58(0\uc73c\ub85c \uc2dc\uc791)\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud55c\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uac12\uc774 -1\uc774\uba74 ] \uc9d1\uacc4 \ud45c\ud604\uc2dd\uc774 \uc778\ub371\uc2a4 \ud0a4 \uc704\uce58\uc640 expr \ud544\ub4dc\uc758 \uc0ac\uc6a9 \ud45c\ud604\uc2dd\uacfc \uc815\ud655\ud788 \uc77c\uce58\ud558\uc9c0 \uc54a\uc74c\uc744 \uc758\ubbf8\ud569\ub2c8\ub2e4.<\/span><\/li>\n<\/ul>\n<\/td>\n<td><span style=\"font-weight: 400\">22<\/span><\/td>\n<td><span style=\"font-weight: 400\">0 <\/span><span style=\"font-weight: 400\">(\uc720\ud615\uc774 def_type \uc778\ub371\uc2a4\uc758 0\ubc88\uc9f8 \uc778\ub371\uc2a4 \ud0a4\uc774\ubbc0\ub85c)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">\uc758\uc874<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uadf8\ub8f9\/\uc9d1\uacc4 \ud45c\ud604\uc2dd\uc774 \uc885\uc18d\ub418\ub294 \uc778\ub371\uc2a4 \ud0a4 \uc704\uce58 \ubaa9\ub85d(\ud1b5\ud569 \ubaa9\ub85d)<\/span><\/td>\n<td><span style=\"font-weight: 400\">25-27<\/span><\/td>\n<td><span style=\"font-weight: 400\">0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">\uadf8\ub8f9<\/span><\/td>\n<td><span style=\"font-weight: 400\">GROUP BY \uac1d\uccb4\uc758 \ubc30\uc5f4\uc774\uba70 \uac01 \uac1d\uccb4\ub294 \ud558\ub098\uc758 \uadf8\ub8f9 \ud0a4\ub97c \ub098\ud0c0\ub0c5\ub2c8\ub2e4. \uc774 \ud56d\ubaa9\uc774 \uc5c6\uc73c\uba74 \ucffc\ub9ac\uc5d0 GROUP BY \uc808\uc774 \uc5c6\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4.<\/span><\/td>\n<td><span style=\"font-weight: 400\">28-37<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uadf8\ub8f9<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0\uc758\uc874<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uadf8\ub8f9 \ud45c\ud604\uc2dd\uc774 \uc758\uc874\ud558\ub294 \uc778\ub371\uc2a4 \ud0a4 \uc704\uce58 \ubaa9\ub85d(0\uc73c\ub85c \uc2dc\uc791).<\/span><\/td>\n<td><span style=\"font-weight: 400\">30-32<\/span><\/td>\n<td><span style=\"font-weight: 400\">0<\/span><\/p>\n<p><span style=\"font-weight: 400\">(\uc720\ud615\uc774 def_type \uc778\ub371\uc2a4\uc758 \uc778\ub371\uc2a4 \ud0a4\uc758 0\ubc88\uc9f8 \ud0a4\uc774\ubbc0\ub85c)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0expr<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uadf8\ub8f9 \ud45c\ud604\uc2dd\uc785\ub2c8\ub2e4.<\/span><\/td>\n<td><span style=\"font-weight: 400\">33<\/span><\/td>\n<td><span style=\"font-weight: 400\">cover ((`travel-sample`.`type`))<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0id<\/span><\/td>\n<td><span style=\"font-weight: 400\">\ub0b4\ubd80\uc801\uc73c\ub85c \ubd80\uc5ec\ub41c \uace0\uc720 ID\ub85c \ub2e4\uc74c\uc5d0\uc11c \uc0ac\uc6a9\ub429\ub2c8\ub2e4. <\/span><span style=\"font-weight: 400\">index_projection.<\/span><\/td>\n<td><span style=\"font-weight: 400\">34<\/span><\/td>\n<td><span style=\"font-weight: 400\">0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\"> \u00a0\u00a0\ud0a4\ud3ec\uc2a4<\/span><\/td>\n<td><span style=\"font-weight: 400\">\uc778\ub371\uc2a4 \ud0a4 \uc704\uce58 \ub610\ub294 expr \ud544\ub4dc\uc5d0\uc11c \ud45c\ud604\uc2dd\uc744 \uc0ac\uc6a9\ud558\ub3c4\ub85d \uc9c0\uc2dc\ud558\ub294 \ud45c\uc2dc\uae30\uc785\ub2c8\ub2e4.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uac12\uc774 -1\ubcf4\ub2e4 \ud06c\uba74 \uadf8\ub8f9 \ud45c\ud604\uc2dd\uc774 \ud574\ub2f9 \uc778\ub371\uc2a4 \ud0a4 \uc704\uce58(0\uc73c\ub85c \uc2dc\uc791)\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud55c\ub2e4\ub294 \uc758\ubbf8\uc785\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uac12\uc774 -1\uc774\uba74 \uadf8\ub8f9 \ud0a4\uac00 \uc778\ub371\uc2a4 \ud0a4 \uc704\uce58\uc640 expr \ud544\ub4dc\uc758 \uc0ac\uc6a9 \ud45c\ud604\uc2dd\uacfc \uc815\ud655\ud788 \uc77c\uce58\ud558\uc9c0 \uc54a\uc74c\uc744 \uc758\ubbf8\ud569\ub2c8\ub2e4.<\/span><\/li>\n<\/ul>\n<\/td>\n<td><span style=\"font-weight: 400\">35<\/span><\/td>\n<td><span style=\"font-weight: 400\">0 <\/span><span style=\"font-weight: 400\">(\uc720\ud615\uc774 def_type \uc778\ub371\uc2a4\uc758 0\ubc88\uc9f8 \uc778\ub371\uc2a4 \ud0a4\uc774\ubbc0\ub85c)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><span style=\"font-weight: 400\">\ucee4\ubc84 \ud544\ub4dc\ub294 \ubc30\uc5f4\uc774\uba70 \ubaa8\ub4e0 \uc778\ub371\uc2a4 \ud0a4, \ubb38\uc11c \ud0a4(META().id), \uc778\ub371\uc2a4 \ud0a4\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud558\uc9c0 \uc54a\ub294 \uadf8\ub8f9 \ud0a4 \ud45c\ud604\uc2dd(id\ubcc4\ub85c \uc815\ub82c), id\ubcc4\ub85c \uc815\ub82c\ub41c \uc9d1\uacc4\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ub610\ud55c \"Index_projection\"\uc740 \ubaa8\ub4e0 \uadf8\ub8f9\/\uc9d1\uacc4 ID\ub97c \uac16\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">\"covers\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"cover ((`travel-sample`.`type`))\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2190 Index key (0)\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"cover ((meta(`travel-sample`).`id`))\", \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2190 document key (1)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"cover (count(cover ((`travel-sample`.`type`))))\" \u00a0\u00a0\u00a0\u00a0\u2190 aggregate (2)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0]<\/pre>\n<p><span style=\"font-weight: 400\">In above case group expression `type` is same Index key of index `def_type`. It is not included twice.<\/span><\/p>\n<h2><b>\uc138\ubd80 \uc815\ubcf4 <\/b><b>\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4<\/b><\/h2>\n<p><span style=\"font-weight: 400\">\uc608\uc81c\ub97c \ud1b5\ud574 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\uac00 \uc5b4\ub5bb\uac8c \uc791\ub3d9\ud558\ub294\uc9c0 \ubcf4\uc5ec\ub4dc\ub9ac\uaca0\uc2b5\ub2c8\ub2e4. \uc608\uc81c\ub97c \ub530\ub974\ub824\uba74 \ub2e4\uc74c\uacfc \uac19\uc774 \ud558\uc138\uc694. <\/span><span style=\"font-weight: 400\">\"\uae30\ubcf8\" \ubc84\ud0b7\uc744 \uc0dd\uc131\ud558\uace0 \ub2e4\uc74c \ubb38\uc11c\ub97c \uc0bd\uc785\ud558\uc138\uc694:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">INSERT INTO default (KEY,VALUE)\r\n    VALUES (\"ga0001\", {\"c0\":1, \"c1\":10, \"c2\":100, \"c3\":1000, \"c4\":10000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]}),\r\n    VALUES (\"ga0002\", {\"c0\":1, \"c1\":20, \"c2\":200, \"c3\":2000, \"c4\":20000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]}),\r\n    VALUES (\"ga0003\", {\"c0\":1, \"c1\":10, \"c2\":300, \"c3\":3000, \"c4\":30000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]}),\r\n    VALUES (\"ga0004\", {\"c0\":1, \"c1\":20, \"c2\":400, \"c3\":4000, \"c4\":40000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]}),\r\n    VALUES (\"ga0005\", {\"c0\":2, \"c1\":10, \"c2\":100, \"c3\":5000, \"c4\":50000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]}),\r\n    VALUES (\"ga0006\", {\"c0\":2, \"c1\":20, \"c2\":200, \"c3\":6000, \"c4\":60000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]}),\r\n    VALUES (\"ga0007\", {\"c0\":2, \"c1\":10, \"c2\":300, \"c3\":7000, \"c4\":70000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]}),\r\n    VALUES (\"ga0008\", {\"c0\":2, \"c1\":20, \"c2\":400, \"c3\":8000, \"c4\":80000, \"a1\":[{\"id\":1}, {\"id\":1}, {\"id\":2}, {\"id\":3}, {\"id\":4}, {\"id\":5}]});<\/pre>\n<h4><\/h4>\n<h3><span style=\"font-weight: 400\">\uc608 1: \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\ub97c \uae30\uc900\uc73c\ub85c \uadf8\ub8f9\ud654<\/span><\/h3>\n<p><span style=\"font-weight: 400\">\ub2e4\uc74c \ucffc\ub9ac\uc640 \uc778\ub371\uc2a4\ub97c \uace0\ub824\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">SELECT d.c0 AS c0, d.c1 AS c1, SUM(d.c3) AS sumc3,\r\n       AVG(d.c4) AS avgc4, COUNT(DISTINCT d.c2) AS dcountc2\r\nFROM default AS d\r\nWHERE d.c0 &gt; 0\r\nGROUP BY d.c0, d.c1\r\nORDER BY d.c0, d.c1\r\nOFFSET 1\r\nLIMIT 2;<\/pre>\n<p>\ud544\uc218 \uc0c9\uc778:<\/p>\n<pre class=\"theme:github lang:mysql decode:true\">CREATE INDEX idx1 ON default(c0, c1, c2, c3, c4);<\/pre>\n<p><span style=\"font-weight: 400\">\u00a0 \u00a0 \u00a0\ucffc\ub9ac\uc5d0\ub294 GROUP BY\uc640 \uc5ec\ub7ec \uc9d1\uacc4\uac00 \uc788\uace0 \uc77c\ubd80 \uc9d1\uacc4\uc5d0\ub294 DISTINCT \uc218\uc815\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ucffc\ub9ac\ub294 \uc778\ub371\uc2a4 idx1\ub85c \ucee4\ubc84\ub420 \uc218 \uc788\uc73c\uba70 \uc220\uc5b4(d.c0 &gt; 0)\ub294 \uc815\ud655\ud55c \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \ubcc0\ud658\ub418\uc5b4 \uc778\ub371\uc2a4 \uc2a4\uce94\uc73c\ub85c \uc804\ub2ec\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc778\ub371\uc2a4\uc640 \ucffc\ub9ac \uc870\ud569\uc740 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ud55c\uc815\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\uc778\ub371\uc2a4\ub294 \uc778\ub371\uc2a4 \ud0a4 \uc815\uc758 \uc21c\uc11c\uc5d0 \ub530\ub77c \uc790\uc5f0\uc2a4\ub7fd\uac8c \uc815\ub82c\ub418\uace0 \uadf8\ub8f9\ud654\ub429\ub2c8\ub2e4. \uc704\uc758 \ucffc\ub9ac\uc5d0\uc11c GROUP BY \ud0a4(d.c0, d.c1)\ub294 \uc778\ub371\uc2a4\uc758 \uc120\ud589 \ud0a4(c0, c1)\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud569\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc778\ub371\uc2a4\ub294 \uac01 \uadf8\ub8f9 \ub370\uc774\ud130\ub97c \ud568\uaed8 \uac00\uc9c0\uace0 \uc788\uc73c\uba70, \uc778\ub371\uc11c\ub294 \uadf8\ub8f9\ub2f9 \ud558\ub098\uc758 \ud589, \uc989 \uc804\uccb4 \uc9d1\uacc4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.  \ub610\ud55c \ucffc\ub9ac\uc5d0\ub294 DISTINCT \uc218\uc815\uc790\uac00 \uc788\ub294 \uc9d1\uacc4\uac00 \uc788\uace0, \uadf8\ub8f9 \ud0a4 \uc218\uc5d0 1\uc744 \ub354\ud55c \uc218\ubcf4\ub2e4 \uc791\uac70\ub098 \uac19\uc740 \uc704\uce58\uc758 \uc778\ub371\uc2a4 \ud0a4 \uc911 \ud558\ub098\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud569\ub2c8\ub2e4(\uc989, \uadf8\ub8f9 \ud0a4\uac00 2\uac1c\uc774\uace0, \uc778\ub371\uc2a4 \ud0a4 \ub4a4\uc5d0 \uc624\ub294 \uadf8\ub8f9 \ud0a4\uc640 DISTINCT \uc218\uc815\uc790\uac00 \uc815\ub82c \uc5c6\uc774 \uc801\uc6a9 \uac00\ub2a5\ud558\ubbc0\ub85c 0,1,2 \uc704\uce58\uc758 \uc778\ub371\uc2a4 \ud0a4 \uc911 \uc5b4\ub290 \ud558\ub098\uac00 \ub420 \uc218 \uc788\uc74c). \ub530\ub77c\uc11c \uc704\uc758 \ucffc\ub9ac\ub294 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ucc98\ub9ac\ud558\ub294 \uc778\ub371\uc11c\uc5d0 \uc801\ud569\ud569\ub2c8\ub2e4. <\/span><\/p>\n<p><span style=\"font-weight: 400\">\uc120\ud589 \uc778\ub371\uc2a4 \ud0a4 \uc911 \ud558\ub098\uac00 \ub204\ub77d\ub418\uc5b4 \uadf8\ub8f9\ud654\ub418\uace0 \ub3d9\uc77c\uc131 \uc220\uc5b4\uac00 \uc788\ub294 \uacbd\uc6b0, \uadf8\ub8f9 \ud0a4\uc5d0 \uc554\uc2dc\uc801\uc73c\ub85c \uc874\uc7ac\ud558\ub294 \uc778\ub371\uc2a4 \ud0a4\ub97c \ucc98\ub9ac\ud558\uc5ec \ud2b9\uc218 \ucd5c\uc801\ud654\uac00 \uc218\ud589\ub418\uace0 \uc804\uccb4 \uc9d1\uacc4\uac00 \uac00\ub2a5\ud55c\uc9c0 \uc5ec\ubd80\ub97c \uacb0\uc815\ud569\ub2c8\ub2e4. \ud30c\ud2f0\uc158 \uc778\ub371\uc2a4\uc758 \uacbd\uc6b0 \uc804\uccb4 \uc9d1\uacc4\ub97c \uc0dd\uc131\ud558\ub824\uba74 \ubaa8\ub4e0 \ud30c\ud2f0\uc158 \ud0a4\uac00 \uadf8\ub8f9 \ud0a4\uc5d0 \uc874\uc7ac\ud574\uc57c \ud569\ub2c8\ub2e4.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4948 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.34-PM-300x79.png\" alt=\"\" width=\"870\" height=\"229\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.34-PM-300x79.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.34-PM-1024x268.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.34-PM-768x201.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.34-PM-20x5.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.34-PM-1320x346.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.04.34-PM.png 1512w\" sizes=\"auto, (max-width: 870px) 100vw, 870px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\uc704\uc758 \uadf8\ub798\ud53d \uc2e4\ud589 \ud2b8\ub9ac\ub294 \uc778\ub371\uc2a4 \uc2a4\uce94(IndexScan3)\uc774 \uc2a4\uce94 \ubc0f \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \uc9d1\uacc4\ub97c \uc218\ud589\ud558\ub294 \uac83\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. \uc778\ub371\uc2a4 \uc2a4\uce94\uc758 \uacb0\uacfc\uac00 \ud22c\uc601\ub429\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\ud14d\uc2a4\ud2b8 \uae30\ubc18 \uc124\uba85 \uc744 \uc0b4\ud3b4 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">{\r\n  \"plan\": {\r\n    \"#operator\": \"Sequence\",\r\n    \"~children\": [\r\n      {\r\n        \"#operator\": \"Sequence\",\r\n        \"~children\": [\r\n          {\r\n            \"#operator\": \"IndexScan3\",\r\n            \"as\": \"d\",\r\n            \"covers\": [\r\n              \"cover ((`d`.`c0`))\",\r\n              \"cover ((`d`.`c1`))\",\r\n              \"cover ((`d`.`c2`))\",\r\n              \"cover ((`d`.`c3`))\",\r\n              \"cover ((`d`.`c4`))\",\r\n              \"cover ((meta(`d`).`id`))\",\r\n              \"cover (count(distinct cover ((`d`.`c2`))))\",\r\n              \"cover (countn(cover ((`d`.`c4`))))\",\r\n              \"cover (sum(cover ((`d`.`c3`))))\",\r\n              \"cover (sum(cover ((`d`.`c4`))))\"\r\n            ],\r\n            \"index\": \"idx1\",\r\n            \"index_group_aggs\": {\r\n              \"aggregates\": [\r\n                {\r\n                  \"aggregate\": \"COUNT\",\r\n                  \"depends\": [\r\n                    2\r\n                  ],\r\n                  \"distinct\": true,\r\n                  \"expr\": \"cover ((`d`.`c2`))\",\r\n                  \"id\": 6,\r\n                  \"keypos\": 2\r\n                },\r\n                {\r\n                  \"aggregate\": \"COUNTN\",\r\n                  \"depends\": [\r\n                    4\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c4`))\",\r\n                  \"id\": 7,\r\n                  \"keypos\": 4\r\n                },\r\n                {\r\n                  \"aggregate\": \"SUM\",\r\n                  \"depends\": [\r\n                    3\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c3`))\",\r\n                  \"id\": 8,\r\n                  \"keypos\": 3\r\n                },\r\n                {\r\n                  \"aggregate\": \"SUM\",\r\n                  \"depends\": [\r\n                    4\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c4`))\",\r\n                  \"id\": 9,\r\n                  \"keypos\": 4\r\n                }\r\n              ],\r\n              \"depends\": [\r\n                0,\r\n                1,\r\n                2,\r\n                3,\r\n                4\r\n              ],\r\n              \"group\": [\r\n                {\r\n                  \"depends\": [\r\n                    0\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c0`))\",\r\n                  \"id\": 0,\r\n                  \"keypos\": 0\r\n                },\r\n                {\r\n                  \"depends\": [\r\n                    1\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c1`))\",\r\n                  \"id\": 1,\r\n                  \"keypos\": 1\r\n                }\r\n              ]\r\n            },\r\n            \"index_id\": \"d06df7c5d379cd5\",\r\n            \"index_order\": [\r\n              {\r\n                \"keypos\": 0\r\n              },\r\n              {\r\n                \"keypos\": 1\r\n              }\r\n            ],\r\n            \"index_projection\": {\r\n              \"entry_keys\": [\r\n                0,\r\n                1,\r\n                6,\r\n                7,\r\n                8,\r\n                9\r\n              ]\r\n            },\r\n            \"keyspace\": \"default\",\r\n            \"limit\": \"2\",\r\n            \"namespace\": \"default\",\r\n            \"offset\": \"1\",\r\n            \"spans\": [\r\n              {\r\n                \"exact\": true,\r\n                \"range\": [\r\n                  {\r\n                    \"inclusion\": 0,\r\n                    \"low\": \"0\"\r\n                  }\r\n                ]\r\n              }\r\n            ],\r\n            \"using\": \"gsi\"\r\n          },\r\n          {\r\n            \"#operator\": \"Parallel\",\r\n            \"maxParallelism\": 1,\r\n            \"~child\": {\r\n              \"#operator\": \"Sequence\",\r\n              \"~children\": [\r\n                {\r\n                  \"#operator\": \"InitialProject\",\r\n                  \"result_terms\": [\r\n                    {\r\n                      \"as\": \"c0\",\r\n                      \"expr\": \"cover ((`d`.`c0`))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"c1\",\r\n                      \"expr\": \"cover ((`d`.`c1`))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"sumc3\",\r\n                      \"expr\": \"cover (sum(cover ((`d`.`c3`))))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"avgc4\",\r\n                      \"expr\": \"(cover (sum(cover ((`d`.`c4`)))) \/ cover (countn(cover ((`d`.`c4`)))))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"dcountc2\",\r\n                      \"expr\": \"cover (count(distinct cover ((`d`.`c2`))))\"\r\n                    }\r\n                  ]\r\n                },\r\n                {\r\n                  \"#operator\": \"FinalProject\"\r\n                }\r\n              ]\r\n            }\r\n          }\r\n        ]\r\n      },\r\n      {\r\n        \"#operator\": \"Limit\",\r\n        \"expr\": \"2\"\r\n      }\r\n    ]\r\n  },\r\n  \"text\": \"SELECT d.c0 AS c0, d.c1 AS c1, SUM(d.c3) AS sumc3, AVG(d.c4) AS avgc4, COUNT(DISTINCT d.c2) AS dcountc2 FROM default AS d\\nWHERE d.c0 &gt; 0 GROUP BY d.c0, d.c1 ORDER BY d.c0, d.c1 OFFSET 1  LIMIT 2;\"\r\n}<\/pre>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\ub294 \ucffc\ub9ac\ub97c \ubcf4\uc5ec\uc8fc\ub294 IndexScan \uc139\uc158\uc758 \"index_group_aggs\"(24-89\uc904)(\uc608: \"#operator\": \"IndexScan3\")\ub294 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac\uac00 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0 \uc220\uc5b4\ub294 \uc815\ud655\ud788 \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \ubcc0\ud658\ub418\uc5b4 \uc2a4\ud32c\uc758 \uc77c\ubd80\ub85c \uc778\ub371\uc2a4 \uc2a4\uce94\uc73c\ub85c \uc804\ub2ec\ub418\ubbc0\ub85c \uc124\uba85\uc5d0 \ud544\ud130 \uc5f0\uc0b0\uc790\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"> \ud0a4\ubcc4 \uadf8\ub8f9\uc740 \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud558\ubbc0\ub85c \uc778\ub371\uc11c\ub294 \uc804\uccb4 \uc9d1\uacc4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4. \ub530\ub77c\uc11c \ucffc\ub9ac \uc11c\ube44\uc2a4\uc5d0\uc11c\ub3c4 \uadf8\ub8f9\ud654\ub97c \uc81c\uac70\ud569\ub2c8\ub2e4(\uc124\uba85\uc5d0 InitialGroup, IntermediateGroup, FinalGroup \uc5f0\uc0b0\uc790\uac00 \uc5c6\uc2b5\ub2c8\ub2e4). <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc778\ub371\uc11c\ub294 \ubaa8\ub4e0 \uadf8\ub8f9 \ud0a4\uc640 \uc9d1\uacc4\ub97c \ud3ec\ud568\ud558\uc5ec \"index_projection\"(99-107\uc904)\uc744 \ud22c\uc0ac\ud569\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac ORDER BY\uac00 \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\uc640 \uc77c\uce58\ud558\uace0 GROUP BY\uac00 \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\uc5d0 \uc788\uc73c\uba74 \uc778\ub371\uc2a4 \uc21c\uc11c\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc774\ub294 \uc124\uba85(91-98\uc904)\uc5d0\uc11c \ucc3e\uc744 \uc218 \uc788\uc73c\uba70 \"#operator\"\ub97c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4: 164-165\uc904 \uc0ac\uc774\uc5d0 \"Order\". \u00a0<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac\ub294 \uc778\ub371\uc2a4 \uc21c\uc11c\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\uace0 \ucffc\ub9ac\uc5d0 HAVING \uc808\uc774 \uc5c6\uc73c\ubbc0\ub85c \"\uc624\ud504\uc14b\" \ubc0f \"\uc81c\ud55c\" \uac12\uc744 \uc778\ub371\uc11c\uc5d0\uac8c \uc804\ub2ec\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc774\ub294 112, 110\ubc88 \ub77c\uc778\uc5d0\uc11c \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \"\uc624\ud504\uc14b\"\uc740 \"#operator\"\uac00 \ud45c\uc2dc\ub418\uc9c0 \uc54a\ub294 \uacbd\uc6b0\uc5d0\ub9cc \uc801\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4: 164-165\uc904 \uc0ac\uc774\uc5d0 \"\uc624\ud504\uc14b\"\uc744 \uc801\uc6a9\ud558\uc9c0\ub9cc \"\uc81c\ud55c\"\uc744 \ub2e4\uc2dc \uc801\uc6a9\ud558\ub294 \uac83\uc740 \ubd88\uac00\ub2a5\ud569\ub2c8\ub2e4. \uc774\ub294 165-168\uc904\uc5d0\uc11c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac\uc5d0 AVG(x)\uac00 \ud3ec\ud568\ub41c \uacbd\uc6b0 SUM(x)\/COUNTN(x)\ub85c \uc7ac\uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. COUNTN(x)\ub294 x\uac00 \uc22b\uc790 \uac12\uc77c \ub54c\ub9cc \uacc4\uc0b0\ub429\ub2c8\ub2e4.<\/span><\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400\">\uc608 2: \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4, LETTING, HAVING\uc744 \uae30\uc900\uc73c\ub85c \uadf8\ub8f9\ud654\ud558\uae30 <\/span><\/h3>\n<p><span style=\"font-weight: 400\">\ub2e4\uc74c \ucffc\ub9ac\uc640 \uc778\ub371\uc2a4\ub97c \uace0\ub824\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">SELECT d.c0 AS c0, d.c1 AS c1, sumc3 AS sumc3,\r\n       AVG(d.c4) AS avgc4, COUNT(DISTINCT d.c2) AS dcountc2\r\nFROM default AS d\r\nWHERE d.c0 &gt; 0\r\nGROUP BY d.c0, d.c1\r\nLETTING sumc3 = SUM(d.c3)\r\nHAVING sumc3 &gt; 0\r\nORDER BY d.c0, d.c1\r\nOFFSET 1\r\nLIMIT 2;<\/pre>\n<p><span style=\"font-weight: 400\">\ud544\uc218 \uc0c9\uc778:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">CREATE INDEX idx1 ON default(c0, c1, c2, c3, c4);<\/pre>\n<p><span style=\"font-weight: 400\">\uc704\uc758 \ucffc\ub9ac\ub294 \uc608\uc81c 1\uacfc \uc720\uc0ac\ud558\uc9c0\ub9cc LETTING, HAVING \uc808\uc774 \uc788\uc2b5\ub2c8\ub2e4. \uc778\ub371\uc11c\uc5d0\uc11c\ub294 \uc774\ub97c \ucc98\ub9ac\ud560 \uc218 \uc5c6\uc73c\ubbc0\ub85c \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4 \ud6c4 \ucffc\ub9ac \uc11c\ube44\uc2a4\uc5d0\uc11c LETTING, HAVING \uc808\uc744 \uc801\uc6a9\ud569\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc2e4\ud589 \ud2b8\ub9ac\uc5d0\uc11c IndexScan3 \ub4a4\uc5d0 Let, Filter \uc5f0\uc0b0\uc790\uac00 \ud45c\uc2dc\ub429\ub2c8\ub2e4. Having \uc808\uc740 \ud544\ud130\uc774\ubbc0\ub85c \"\uc624\ud504\uc14b\", \"\uc81c\ud55c\" \ud56d\ubaa9\uc740 \uc778\ub371\uc11c\uc5d0 \ud478\uc2dc\ud560 \uc218 \uc5c6\uace0 \ucffc\ub9ac \uc11c\ube44\uc2a4\uc5d0\uc11c \uc801\uc6a9\ud574\uc57c \ud558\uc9c0\ub9cc \uc778\ub371\uc2a4 \uc21c\uc11c\ub294 \uacc4\uc18d \uc0ac\uc6a9\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4947 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.02-PM-300x54.png\" alt=\"\" width=\"1239\" height=\"223\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.02-PM-300x54.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.02-PM-768x139.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.02-PM-20x4.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.02-PM-1320x239.png 1320w\" sizes=\"auto, (max-width: 1239px) 100vw, 1239px\" \/><\/p>\n<h3><span style=\"font-weight: 400\">\uc608 3: \uc120\ud589\uc774 \uc544\ub2cc \uc778\ub371\uc2a4 \ud0a4\ub97c \uae30\uc900\uc73c\ub85c \uadf8\ub8f9\ud654\ud558\uae30<\/span><\/h3>\n<p><span style=\"font-weight: 400\">\ub2e4\uc74c \ucffc\ub9ac\uc640 \uc778\ub371\uc2a4\ub97c \uace0\ub824\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">SELECT d.c1 AS c1, d.c2 AS c2, SUM(d.c3) AS sumc3,\r\n       AVG(d.c4) AS avgc4, COUNT(d.c2) AS countc2\r\nFROM default AS d\r\nWHERE d.c0 &gt; 0\r\nGROUP BY d.c1, d.c2\r\nORDER BY d.c1, d.c2\r\nOFFSET 1\r\nLIMIT 2;<\/pre>\n<p><span style=\"font-weight: 400\">\ud544\uc218 \uc0c9\uc778:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">CREATE INDEX idx1 ON default(c0, c1, c2, c3, c4);\r\n\r\n<\/pre>\n<p><span style=\"font-weight: 400\"> \u00a0\u00a0\u00a0\u00a0<\/span><span style=\"font-weight: 400\">\ucffc\ub9ac\uc5d0\ub294 GROUP BY\uc640 \uc5ec\ub7ec \uc9d1\uacc4\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ucffc\ub9ac\ub294 \uc778\ub371\uc2a4 idx1\uc5d0 \ud3ec\ud568\ub420 \uc218 \uc788\uc73c\uba70 \uc220\uc5b4(d.c0 &gt; 0)\ub294 \uc815\ud655\ud55c \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \ubcc0\ud658\ub418\uc5b4 \uc778\ub371\uc2a4 \uc2a4\uce94\uc73c\ub85c \uc804\ub2ec\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc778\ub371\uc2a4\uc640 \ucffc\ub9ac \uc870\ud569\uc740 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ud55c\uc815\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\uc704\uc758 \ucffc\ub9ac\uc5d0\uc11c GROUP BY \ud0a4(d.c1, d.c2)\ub294 \uc778\ub371\uc2a4\uc758 \uc120\ud589 \ud0a4(c0, c1)\uc640 \uc77c\uce58\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \uadf8\ub8f9\uc774 \uc778\ub371\uc2a4 \uc804\uccb4\uc5d0 \ud769\uc5b4\uc838 \uc788\uc2b5\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc778\ub371\uc11c\ub294 \uac01 \uadf8\ub8f9\ub2f9 \uc5ec\ub7ec \ud589\uc744 \uc0dd\uc131\ud569\ub2c8\ub2e4(\uc989, \ubd80\ubd84 \uc9d1\uacc4). \ubd80\ubd84 \uc9d1\uacc4 \ucffc\ub9ac \uc11c\ube44\uc2a4\uac00 \uadf8\ub8f9 \ubcd1\ud569\uc744 \uc218\ud589\ud558\ub294 \uacbd\uc6b0, \ucffc\ub9ac\ub294 \uc778\ub371\uc2a4 \uc21c\uc11c\ub97c \uc0ac\uc6a9\ud558\uac70\ub098 \uc778\ub371\uc11c\uc5d0 \"\uc624\ud504\uc14b\", \"\uc81c\ud55c\"\uc744 \ud478\uc2dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.  \ubd80\ubd84 \uc9d1\uacc4\uc758 \uacbd\uc6b0 \uc9d1\uacc4\uc5d0 DISTINCT \uc218\uc815\uc790 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654\uac00 \uc788\ub294 \uacbd\uc6b0 \uc9d1\uacc4\uac00 \ubd88\uac00\ub2a5\ud569\ub2c8\ub2e4. \uc704\uc758 \ucffc\ub9ac\ub294 \uc778\ub371\uc11c\uac00 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ucc98\ub9ac\ud558\ub294 \ub370 \uc801\ud569\ud569\ub2c8\ub2e4. <\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4946 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.16-PM-300x60.png\" alt=\"\" width=\"885\" height=\"177\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.16-PM-300x60.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.16-PM-768x153.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.16-PM-20x4.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.16-PM-1320x262.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.16-PM.png 1520w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\uc704\uc758 \uadf8\ub798\ud53d \uc2e4\ud589 \ud2b8\ub9ac\ub294 \uc778\ub371\uc2a4 \uc2a4\uce94(IndexScan3)\uc774 \uc2a4\uce94 \ubc0f \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \uc9d1\uacc4\ub97c \uc218\ud589\ud558\ub294 \uac83\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. \uc778\ub371\uc2a4 \uc2a4\uce94 \uacb0\uacfc\ub294 \ub2e4\uc2dc \uadf8\ub8f9\ud654\ub418\uc5b4 \ud22c\uc601\ub429\ub2c8\ub2e4.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\ud14d\uc2a4\ud2b8 \uae30\ubc18 \uc124\uba85 \uc744 \uc0b4\ud3b4 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">{\r\n  \"plan\": {\r\n    \"#operator\": \"Sequence\",\r\n    \"~children\": [\r\n      {\r\n        \"#operator\": \"Sequence\",\r\n        \"~children\": [\r\n          {\r\n            \"#operator\": \"IndexScan3\",\r\n            \"as\": \"d\",\r\n            \"covers\": [\r\n              \"cover ((`d`.`c0`))\",\r\n              \"cover ((`d`.`c1`))\",\r\n              \"cover ((`d`.`c2`))\",\r\n              \"cover ((`d`.`c3`))\",\r\n              \"cover ((`d`.`c4`))\",\r\n              \"cover ((meta(`d`).`id`))\",\r\n              \"cover (count(cover ((`d`.`c2`))))\",\r\n              \"cover (countn(cover ((`d`.`c4`))))\",\r\n              \"cover (sum(cover ((`d`.`c3`))))\",\r\n              \"cover (sum(cover ((`d`.`c4`))))\"\r\n            ],\r\n            \"index\": \"idx1\",\r\n            \"index_group_aggs\": {\r\n              \"aggregates\": [\r\n                {\r\n                  \"aggregate\": \"COUNT\",\r\n                  \"depends\": [\r\n                    2\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c2`))\",\r\n                  \"id\": 6,\r\n                  \"keypos\": 2\r\n                },\r\n                {\r\n                  \"aggregate\": \"COUNTN\",\r\n                  \"depends\": [\r\n                    4\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c4`))\",\r\n                  \"id\": 7,\r\n                  \"keypos\": 4\r\n                },\r\n                {\r\n                  \"aggregate\": \"SUM\",\r\n                  \"depends\": [\r\n                    3\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c3`))\",\r\n                  \"id\": 8,\r\n                  \"keypos\": 3\r\n                },\r\n                {\r\n                  \"aggregate\": \"SUM\",\r\n                  \"depends\": [\r\n                    4\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c4`))\",\r\n                  \"id\": 9,\r\n                  \"keypos\": 4\r\n                }\r\n              ],\r\n              \"depends\": [\r\n                1,\r\n                2,\r\n                3,\r\n                4\r\n              ],\r\n              \"group\": [\r\n                {\r\n                  \"depends\": [\r\n                    1\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c1`))\",\r\n                  \"id\": 1,\r\n                  \"keypos\": 1\r\n                },\r\n                {\r\n                  \"depends\": [\r\n                    2\r\n                  ],\r\n                  \"expr\": \"cover ((`d`.`c2`))\",\r\n                  \"id\": 2,\r\n                  \"keypos\": 2\r\n                }\r\n              ],\r\n              \"partial\": true\r\n            },\r\n            \"index_id\": \"d06df7c5d379cd5\",\r\n            \"index_projection\": {\r\n              \"entry_keys\": [\r\n                1,\r\n                2,\r\n                6,\r\n                7,\r\n                8,\r\n                9\r\n              ]\r\n            },\r\n            \"keyspace\": \"default\",\r\n            \"namespace\": \"default\",\r\n            \"spans\": [\r\n              {\r\n                \"exact\": true,\r\n                \"range\": [\r\n                  {\r\n                    \"inclusion\": 0,\r\n                    \"low\": \"0\"\r\n                  }\r\n                ]\r\n              }\r\n            ],\r\n            \"using\": \"gsi\"\r\n          },\r\n          {\r\n            \"#operator\": \"Parallel\",\r\n            \"~child\": {\r\n              \"#operator\": \"Sequence\",\r\n              \"~children\": [\r\n                {\r\n                  \"#operator\": \"InitialGroup\",\r\n                  \"aggregates\": [\r\n                    \"sum(cover (count(cover ((`d`.`c2`)))))\",\r\n                    \"sum(cover (countn(cover ((`d`.`c4`)))))\",\r\n                    \"sum(cover (sum(cover ((`d`.`c3`)))))\",\r\n                    \"sum(cover (sum(cover ((`d`.`c4`)))))\"\r\n                  ],\r\n                  \"group_keys\": [\r\n                    \"cover ((`d`.`c1`))\",\r\n                    \"cover ((`d`.`c2`))\"\r\n                  ]\r\n                }\r\n              ]\r\n            }\r\n          },\r\n          {\r\n            \"#operator\": \"IntermediateGroup\",\r\n            \"aggregates\": [\r\n              \"sum(cover (count(cover ((`d`.`c2`)))))\",\r\n              \"sum(cover (countn(cover ((`d`.`c4`)))))\",\r\n              \"sum(cover (sum(cover ((`d`.`c3`)))))\",\r\n              \"sum(cover (sum(cover ((`d`.`c4`)))))\"\r\n            ],\r\n            \"group_keys\": [\r\n              \"cover ((`d`.`c1`))\",\r\n              \"cover ((`d`.`c2`))\"\r\n            ]\r\n          },\r\n          {\r\n            \"#operator\": \"FinalGroup\",\r\n            \"aggregates\": [\r\n              \"sum(cover (count(cover ((`d`.`c2`)))))\",\r\n              \"sum(cover (countn(cover ((`d`.`c4`)))))\",\r\n              \"sum(cover (sum(cover ((`d`.`c3`)))))\",\r\n              \"sum(cover (sum(cover ((`d`.`c4`)))))\"\r\n            ],\r\n            \"group_keys\": [\r\n              \"cover ((`d`.`c1`))\",\r\n              \"cover ((`d`.`c2`))\"\r\n            ]\r\n          },\r\n          {\r\n            \"#operator\": \"Parallel\",\r\n            \"~child\": {\r\n              \"#operator\": \"Sequence\",\r\n              \"~children\": [\r\n                {\r\n                  \"#operator\": \"InitialProject\",\r\n                  \"result_terms\": [\r\n                    {\r\n                      \"as\": \"c1\",\r\n                      \"expr\": \"cover ((`d`.`c1`))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"c2\",\r\n                      \"expr\": \"cover ((`d`.`c2`))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"sumc3\",\r\n                      \"expr\": \"sum(cover (sum(cover ((`d`.`c3`)))))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"avgc4\",\r\n                      \"expr\": \"(sum(cover (sum(cover ((`d`.`c4`))))) \/ sum(cover (countn(cover ((`d`.`c4`))))))\"\r\n                    },\r\n                    {\r\n                      \"as\": \"countc2\",\r\n                      \"expr\": \"sum(cover (count(cover ((`d`.`c2`)))))\"\r\n                    }\r\n                  ]\r\n                }\r\n              ]\r\n            }\r\n          }\r\n        ]\r\n      },\r\n      {\r\n        \"#operator\": \"Order\",\r\n        \"limit\": \"2\",\r\n        \"offset\": \"1\",\r\n        \"sort_terms\": [\r\n          {\r\n            \"expr\": \"cover ((`d`.`c1`))\"\r\n          },\r\n          {\r\n            \"expr\": \"cover ((`d`.`c2`))\"\r\n          }\r\n        ]\r\n      },\r\n      {\r\n        \"#operator\": \"Offset\",\r\n        \"expr\": \"1\"\r\n      },\r\n      {\r\n        \"#operator\": \"Limit\",\r\n        \"expr\": \"2\"\r\n      },\r\n      {\r\n        \"#operator\": \"FinalProject\"\r\n      }\r\n    ]\r\n  },\r\n  \"text\": \"SELECT d.c1 AS c1, d.c2 AS c2, SUM(d.c3) AS sumc3, AVG(d.c4) AS avgc4, COUNT(d.c2) AS countc2 FROM default AS d WHERE d.c0 &gt; 0 GROUP BY d.c1, d.c2 ORDER BY d.c1, d.c2 OFFSET 1  LIMIT 2;\"\r\n}<\/pre>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\ub294 \ucffc\ub9ac\ub97c \ubcf4\uc5ec\uc8fc\ub294 IndexScan \uc139\uc158(\uc989, \"#operator\": \"IndexScan3\")\uc758 \"index_group_aggs\"(24~88\ud589)\ub294 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac\uac00 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\ub294 \uacbd\uc6b0 \uc220\uc5b4\ub294 \uc815\ud655\ud788 \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \ubcc0\ud658\ub418\uc5b4 \uc2a4\ud32c\uc758 \uc77c\ubd80\ub85c \uc778\ub371\uc2a4 \uc2a4\uce94\uc73c\ub85c \uc804\ub2ec\ub418\ubbc0\ub85c \uc124\uba85\uc5d0 \ud544\ud130 \uc5f0\uc0b0\uc790\uac00 \uc5c6\uc2b5\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"> \ud0a4\ubcc4 \uadf8\ub8f9\ud654\uac00 \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\uc640 \uc77c\uce58\ud558\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 \uc778\ub371\uc11c\ub294 \ubd80\ubd84 \uc9d1\uacc4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4. \uc774\uac83\uc740 87\uc904\uc758 \"index_group_aggs\" \ub0b4\uc5d0\uc11c \"partial\":true\ub85c \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ucffc\ub9ac \uc11c\ube44\uc2a4\uac00 \uadf8\ub8f9 \ubcd1\ud569\uc744 \uc218\ud589\ud569\ub2c8\ub2e4(119~161\uc904 \ucc38\uc870).<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc778\ub371\uc11c\ub294 \uadf8\ub8f9 \ud0a4\uc640 \uc9d1\uacc4\uac00 \ud3ec\ud568\ub41c \"index_projection\"(91-99\uc904)\uc744 \ud22c\uc0ac\ud569\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc778\ub371\uc11c\uac00 \ubd80\ubd84 \uc9d1\uacc4\ub97c \uc0dd\uc131\ud558\ub294 \ucffc\ub9ac\ub294 \uc778\ub371\uc2a4 \uc21c\uc11c\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uace0 \uba85\uc2dc\uc801\uc778 \uc815\ub82c\uc774 \ud544\uc694\ud558\uba70 \"offset\", \"limit\"\uc744 \uc778\ub371\uc11c\uc5d0 \ud478\uc2dc\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. \uc774 \uacc4\ud68d\uc5d0\ub294 \uba85\uc2dc\uc801\uc778 \"Order\", \"Offset\", \"Limit\" \uc5f0\uc0b0\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4(197~217\uc904).<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac\uc5d0\ub294 AVG(x)\uac00 \ud3ec\ud568\ub418\uba70, \uc774 \ucffc\ub9ac\ub294 SUM(x)\/COUNTN(x)\ub85c \uc7ac\uc791\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. COUNTN(x)\ub294 x\uac00 \uc22b\uc790 \uac12\uc77c \ub54c\ub9cc \uacc4\uc0b0\ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uadf8\ub8f9 \ubcd1\ud569 \uc911<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">MIN\uc774 MIN\uc758 MIN\uc774 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">MAX\ub294 MAX\uc758 MAX\uac00 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">SUM\uc774 SUM\uc758 \ud569\uacc4\uac00 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uce74\uc6b4\ud2b8\ub294 \uce74\uc6b4\ud2b8\uc758 \ud569\uacc4\uac00 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">CONTN\uc774 COUNTN\uc758 \ud569\uacc4\uac00 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">AVG\ub294 SUM\uc744 SUM\uc758 \ud569\uacc4\ub85c \ub098\ub208 \uac12\uc774 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3><span style=\"font-weight: 400\">\uc608 4: \ubc30\uc5f4 \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud55c \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4<\/span><\/h3>\n<p><span style=\"font-weight: 400\">\ub2e4\uc74c \ucffc\ub9ac\uc640 \uc778\ub371\uc2a4\ub97c \uace0\ub824\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">SELECT d.c0 AS c0, d.c1 AS c1, SUM(d.c3) AS sumc3,\r\n       AVG(d.c4) AS avgc4, COUNT(DISTINCT d.c2) AS dcountc2\r\nFROM default AS d\r\nWHERE d.c0 &gt; 0 AND d.c1 &gt;= 10 AND ANY v IN d.a1 SATISFIES v.id = 3 END\r\nGROUP BY d.c0, d.c1\r\nORDER BY d.c0, d.c1\r\nOFFSET 1\r\nLIMIT 2;\r\n<\/pre>\n<p><span style=\"font-weight: 400\">\ud544\uc218 \uc0c9\uc778:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">CREATE INDEX idxad1 ON default(c0, c1, DISTINCT ARRAY v.id FOR v IN a1 END, c2, c3, c4);<\/pre>\n<p><span style=\"font-weight: 400\">\ucffc\ub9ac\uc5d0 GROUP BY \ubc0f \uc5ec\ub7ec \uc9d1\uacc4\uac00 \uc788\uace0 \uc77c\ubd80 \uc9d1\uacc4\uc5d0\ub294 DISTINCT \uc218\uc815\uc790\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ucffc\ub9ac \uc220\uc5b4\uc5d0 ANY \uc808\uc774 \uc788\uace0 \ucffc\ub9ac\ub294 \ubc30\uc5f4 \uc778\ub371\uc2a4 idxad1\ub85c \ucee4\ubc84\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc870\uac74 (d.c0 &gt; 0 AND d,c11 &gt;= 10 AND ANY v IN d.a1 SATISFIES <\/span><span style=\"font-weight: 400\">v.id <\/span><span style=\"font-weight: 400\">= 3 END)\ub97c \uc815\ud655\ud55c \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \ubcc0\ud658\ud558\uc5ec \uc778\ub371\uc2a4 \uc2a4\uce94\uc73c\ub85c \uc804\ub2ec\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ubc30\uc5f4 \uc778\ub371\uc2a4 \uc778\ub371\uc11c\ub294 \uac01 \ubc30\uc5f4 \uc778\ub371\uc2a4 \ud0a4\uc5d0 \ub300\ud574 \ubcc4\ub3c4\uc758 \uc694\uc18c\ub97c \uc720\uc9c0\ud558\ubbc0\ub85c \uc778\ub371\uc2a4 \uadf8\ub8f9 \ubc0f \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\ub824\uba74 SATISFIES \uc220\uc5b4\uc5d0 \ub2e8\uc77c \uac19\uc74c \uc220\uc5b4\uac00 \uc788\uc5b4\uc57c \ud558\uace0 \ubc30\uc5f4 \uc778\ub371\uc2a4 \ud0a4\uc5d0 DISTINCT \uc218\uc815\uc790\uac00 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4. \ub530\ub77c\uc11c \uc778\ub371\uc2a4\uc640 \ucffc\ub9ac \uc870\ud569\uc740 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ucc98\ub9ac\ud558\ub294 \ub370 \uc801\ud569\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4945 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.38-PM-300x83.png\" alt=\"\" width=\"886\" height=\"245\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.38-PM-300x83.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.38-PM-1024x284.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.38-PM-768x213.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.38-PM-20x6.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.38-PM-1320x366.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.05.38-PM.png 1494w\" sizes=\"auto, (max-width: 886px) 100vw, 886px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\uc774 \uc608\uc81c\ub294 \ubc30\uc5f4 \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud55c\ub2e4\ub294 \uc810\uc744 \uc81c\uc678\ud558\uba74 \uc608\uc81c 1\uacfc \uc720\uc0ac\ud569\ub2c8\ub2e4. \uc704\uc758 \uadf8\ub798\ud53d \uc2e4\ud589 \ud2b8\ub9ac\ub294 \uc2a4\uce94, \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \uc9d1\uacc4, \uc21c\uc11c, \uc624\ud504\uc14b \ubc0f \uc81c\ud55c\uc744 \uc218\ud589\ud558\ub294 \uc778\ub371\uc2a4 \uc2a4\uce94(IndexScan3)\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. \uc778\ub371\uc2a4 \uc2a4\uce94\uc758 \uacb0\uacfc\uac00 \ud22c\uc601\ub429\ub2c8\ub2e4.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">\uc608\uc81c 5: UNNEST \uc791\uc5c5\uc758 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4<\/span><\/h3>\n<p><span style=\"font-weight: 400\">\ub2e4\uc74c \ucffc\ub9ac\uc640 \uc778\ub371\uc2a4\ub97c \uace0\ub824\ud574 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">SELECT v.id AS id, d.c0 AS c0, SUM(v.id) AS sumid,\r\n       AVG(d.c1) AS avgc1\r\nFROM default AS d UNNEST d.a1 AS v\r\nWHERE v.id &gt; 0\r\nGROUP BY v.id, d.c0;<\/pre>\n<p><span style=\"font-weight: 400\">\ud544\uc218 \uc0c9\uc778:<\/span><\/p>\n<pre class=\"theme:github lang:mysql decode:true\">CREATE INDEX idxaa1 ON default(ALL ARRAY v.id FOR v IN a1 END, c0, c1);<\/pre>\n<p><span style=\"font-weight: 400\">\ucffc\ub9ac\uc5d0 GROUP BY \ubc0f \uc5ec\ub7ec \uc9d1\uacc4\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ucffc\ub9ac\uc5d0 \ubc30\uc5f4 d.a1\uc5d0 UNNEST\uac00 \uc788\uace0 \ubc30\uc5f4 \ud0a4\uc5d0 \uc220\uc5b4\uac00 \uc788\uc2b5\ub2c8\ub2e4(v.id &gt; 0).  \uc778\ub371\uc2a4 idxaa1\uc740 \ucffc\ub9ac\ub97c \ud55c\uc815\ud569\ub2c8\ub2e4(\uc778\ub371\uc2a4 \uc2a4\uce94\uc5d0 \ubc30\uc5f4 \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud558\ub824\uba74 \ubc30\uc5f4 \uc778\ub371\uc2a4\uac00 \uc120\ud589 \ud0a4\uc5ec\uc57c \ud558\uace0 \uc778\ub371\uc2a4 \uc815\uc758\uc758 \ubc30\uc5f4 \ubcc0\uc218\uac00 UNNEST \ubcc4\uce6d\uacfc \uc77c\uce58\ud574\uc57c \ud569\ub2c8\ub2e4). \uc220\uc5b4(v.id &gt; 0)\ub294 \uc815\ud655\ud55c \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \ubcc0\ud658\ub418\uc5b4 \uc778\ub371\uc2a4 \uc2a4\uce94\uc73c\ub85c \uc804\ub2ec\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4.  \ub530\ub77c\uc11c \uc778\ub371\uc2a4\uc640 \ucffc\ub9ac \uc870\ud569\uc740 \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \ucc98\ub9ac\ud558\ub294 \ub370 \uc801\ud569\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4944 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2018\/04\/Screen-Shot-2018-04-03-at-7.06.17-PM-300x101.png\" alt=\"\" width=\"864\" height=\"291\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.06.17-PM-300x101.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.06.17-PM-1024x345.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.06.17-PM-768x259.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.06.17-PM-20x7.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.06.17-PM-1320x445.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-7.06.17-PM.png 1526w\" sizes=\"auto, (max-width: 864px) 100vw, 864px\" \/><\/p>\n<p><span style=\"font-weight: 400\">\uc704\uc758 \uadf8\ub798\ud53d \uc2e4\ud589 \ud2b8\ub9ac\ub294 \uc778\ub371\uc2a4 \uc2a4\uce94(IndexScan3)\uc774 \uc2a4\uce94, \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \uc9d1\uacc4\ub97c \uc218\ud589\ud558\ub294 \uac83\uc744 \ubcf4\uc5ec\uc90d\ub2c8\ub2e4. \uc778\ub371\uc2a4 \uc2a4\uce94\uc758 \uacb0\uacfc\uac00 \ud22c\uc601\ub429\ub2c8\ub2e4. UNNEST\ub294 \ubd80\ubaa8\uc640 \uac01 \ubc30\uc5f4 \uc694\uc18c \uc0ac\uc774\uc758 \ud2b9\uc218\ud55c \uc720\ud615\uc758 JOIN\uc785\ub2c8\ub2e4. <\/span><span style=\"font-weight: 400\">\ub530\ub77c\uc11c UNNEST\ub294 \uc0c1\uc704 \ubb38\uc11c \ud544\ub4dc(d.c0, d.c1)\uc640 \ud558\uc704 \ubb38\uc11c \ud544\ub4dc(d.c0, d.c1)\ub97c \ubc18\ubcf5\ud569\ub2c8\ub2e4. <\/span><span style=\"font-weight: 400\">D.C0, DC.1<\/span><span style=\"font-weight: 400\"> \ucc38\uc870\ub294 \uc6d0\ubcf8\uacfc \ube44\uad50\ud558\uc5ec \uc911\ubcf5\uc774 \uc788\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4. <\/span><span style=\"font-weight: 400\">d<\/span><span style=\"font-weight: 400\"> \ubb38\uc11c(SUM(), AVG()\uc5d0\uc11c \uc0ac\uc6a9\ud560 \ub54c\ub294 \uc774 \uc810\uc744 \uc720\uc758\ud574\uc57c \ud569\ub2c8\ub2e4).<\/span><\/p>\n<h2><b>\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4 \uaddc\uce59<\/b><\/h2>\n<p><span style=\"font-weight: 400\"> \u00a0<\/span><span style=\"font-weight: 400\">\u00a0\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub294 \ucffc\ub9ac \ube14\ub85d \ub2e8\uc704\ub85c \uc774\ub8e8\uc5b4\uc9c0\uba70, \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654\/\uc9d1\uacc4 \uc0ac\uc6a9 \uc5ec\ubd80\ub294 \uc778\ub371\uc2a4 \uc120\ud0dd \ud504\ub85c\uc138\uc2a4 \ud6c4\uc5d0\ub9cc \uacb0\uc815\ub429\ub2c8\ub2e4.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac \ube14\ub85d\uc5d0\ub294 \uc870\uc778, NEST, SUB\ucffc\ub9ac\uac00 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac \ube14\ub85d\uc740 \ub2e8\uc77c \ub77c\uc778 \uc778\ub371\uc2a4\ub85c \ub36e\uc5ec \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac \ube14\ub85d\uc5d0 ARRAY_AGG()\uac00 \ud3ec\ud568\ub418\uc5b4\uc11c\ub294 \uc548 \ub429\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ucffc\ub9ac \ube14\ub85d\uc744 \uc0c1\ud638 \uc5f0\uad00\uc2dc\ud0ac \uc218 \uc5c6\uc74c<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\ubaa8\ub4e0 \uc220\uc5b4\ub294 \ubc94\uc704 \uc2a4\uce94\uc73c\ub85c \uc815\ud655\ud558\uac8c \ubc88\uc5ed\ub418\uc5b4\uc57c \ud569\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">GROUP BY, \uc9d1\uacc4 \ud45c\ud604\uc2dd\uc740 \ud558\uc704 \ucffc\ub9ac, \uba85\uba85\ub41c \ub9e4\uac1c \ubcc0\uc218, \uc704\uce58 \ub9e4\uac1c \ubcc0\uc218\ub97c \ucc38\uc870\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">GROUP BY \ud0a4\uc5d0\uc11c \uc9d1\uacc4 \ud45c\ud604\uc2dd\uc740 \uc778\ub371\uc2a4 \ud0a4, \ubb38\uc11c \ud0a4, \uc778\ub371\uc2a4 \ud0a4\uc758 \ud45c\ud604\uc2dd \ub610\ub294 \ubb38\uc11c \ud0a4\uc758 \ud45c\ud604\uc2dd\uc774 \ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc778\ub371\uc2a4\ub294 \ucffc\ub9ac \ube14\ub85d\uc758 \ubaa8\ub4e0 \uc9d1\uacc4\uc5d0 \ub300\ud574 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc218\ud589\ud560 \uc218 \uc788\uc5b4\uc57c \ud558\uba70, \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \uc778\ub371\uc2a4 \uc9d1\uacc4\ub97c \uc218\ud589\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. (\uc989, ALL \ub610\ub294 None)<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc9d1\uacc4\uc5d0 DISTINCT \uc218\uc815\uc790 \ud3ec\ud568<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"> \uadf8\ub8f9 \ud0a4\ub294 \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud574\uc57c \ud569\ub2c8\ub2e4(\ucffc\ub9ac\uc5d0 \uc778\ub371\uc2a4 \ud0a4\uc5d0 \ub3d9\uc77c\uc131 \uc220\uc5b4\uac00 \ud3ec\ud568\ub41c \uacbd\uc6b0, \uc774 \uc778\ub371\uc2a4 \ud0a4\uac00 \uc544\uc9c1 \uc5c6\ub294 \uacbd\uc6b0 GROUP \ud0a4\uc5d0 \uc554\uc2dc\uc801\uc73c\ub85c \ud3ec\ud568\ub418\uc5b4 \uc788\ub2e4\uace0 \uac00\uc815\ud569\ub2c8\ub2e4). <\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">\uc9d1\uacc4 \ud45c\ud604\uc2dd\uc740 n+1 \uc120\ud589 \uc778\ub371\uc2a4 \ud0a4 \uc911 \ud558\ub098\uc5d0 \uc788\uc5b4\uc57c \ud569\ub2c8\ub2e4(n\uc740 \uadf8\ub8f9 \ud0a4\uc758 \uc218\ub97c \ub098\ud0c0\ub0c4).<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"> \ud30c\ud2f0\uc158 \uc778\ub371\uc2a4\uc758 \uacbd\uc6b0 \ud30c\ud2f0\uc158 \ud0a4\ub294 \uadf8\ub8f9 \ud0a4\uc640 \uc815\ud655\ud788 \uc77c\uce58\ud574\uc57c \ud569\ub2c8\ub2e4.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2><b>\uc694\uc57d<\/b><\/h2>\n<p><span style=\"font-weight: 400\">\uc124\uba85 \uacc4\ud68d\uc744 \ubd84\uc11d\ud560 \ub54c \uc124\uba85\uc758 \uc220\uc5b4\ub97c \uc2a4\ud32c\uacfc \uc5f0\uad00\uc2dc\ud0a4\uace0 \ubaa8\ub4e0 \uc220\uc5b4\uac00 \ubc94\uc704 \uc2a4\uce94\uacfc \ucffc\ub9ac\uc5d0 \uc815\ud655\ud788 \ubcc0\ud658\ub418\uc5b4 \uc788\ub294\uc9c0 \ud655\uc778\ud569\ub2c8\ub2e4. \uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\uc5ec \ucffc\ub9ac\ud558\uace0, \uac00\ub2a5\ud558\uba74 \uc778\ub371\uc2a4 \ud0a4\ub97c \uc870\uc815\ud558\uc5ec \uc778\ub371\uc11c\uc5d0\uc11c \uc804\uccb4 \uc9d1\uacc4\ub97c \uc0ac\uc6a9\ud558\uc5ec \ucffc\ub9ac\ud558\ub294 \uac83\uc774 \ub354 \ub098\uc740 \uc131\ub2a5\uc744 \ubcf4\uc7a5\ud569\ub2c8\ub2e4.<\/span><\/p>","protected":false},"excerpt":{"rendered":"<p>Couchbase N1QL is a modern query processing engine designed to provide aggregate SQL for JSON by index on distributed data with a flexible data model. Modern databases are deployed on massive clusters. Using JSON provides a flexible data mode. N1QL [&hellip;]<\/p>","protected":false},"author":7586,"featured_media":4938,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,1816,9417,1812],"tags":[2173,1572,2042,1505,1261,1725],"ppma_author":[9067],"class_list":["post-4935","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-couchbase-server","category-performance","category-n1ql-query","tag-aggregates","tag-database","tag-grouping","tag-index","tag-json","tag-nosql-database"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL Group by Index | Aggregate Index SQL | Couchbase<\/title>\n<meta name=\"description\" content=\"Index grouping and aggregations can improve query performance magnitude and reduce the latencies to make SQL for JSON query processing easier.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/ko\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Index Grouping And Aggregation in Couchbase N1QL Query\" \/>\n<meta property=\"og:description\" content=\"Index grouping and aggregations can improve query performance magnitude and reduce the latencies to make SQL for JSON query processing easier.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/ko\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-04T02:31:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T06:43:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1388\" \/>\n\t<meta property=\"og:image:height\" content=\"744\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sitaram Vemulapalli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sitaram Vemulapalli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"21\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/\"},\"author\":{\"name\":\"Sitaram Vemulapalli\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ead1d6aa77984d26b03977adca6f174f\"},\"headline\":\"Understanding Index Grouping And Aggregation in Couchbase N1QL Query\",\"datePublished\":\"2018-04-04T02:31:02+00:00\",\"dateModified\":\"2025-06-14T06:43:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/\"},\"wordCount\":2976,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png\",\"keywords\":[\"aggregates\",\"database\",\"grouping\",\"Index\",\"JSON\",\"NoSQL Database\"],\"articleSection\":[\"Application Design\",\"Couchbase Server\",\"High Performance\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/\",\"name\":\"SQL Group by Index | Aggregate Index SQL | Couchbase\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png\",\"datePublished\":\"2018-04-04T02:31:02+00:00\",\"dateModified\":\"2025-06-14T06:43:08+00:00\",\"description\":\"Index grouping and aggregations can improve query performance magnitude and reduce the latencies to make SQL for JSON query processing easier.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png\",\"width\":1388,\"height\":744},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding Index Grouping And Aggregation in Couchbase N1QL Query\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ead1d6aa77984d26b03977adca6f174f\",\"name\":\"Sitaram Vemulapalli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/988725d1a67be1227a105a4071c69e2b\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/67edc83f4123b955cf7c20e1c509799b94a1fb14d1aedb3c226b998081714da3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/67edc83f4123b955cf7c20e1c509799b94a1fb14d1aedb3c226b998081714da3?s=96&d=mm&r=g\",\"caption\":\"Sitaram Vemulapalli\"},\"description\":\"Sitaram Vemulapalli is a Principal Software Engineer at Couchbase. Prior to Couchbase, he served as an architect for IBM Informix SQL and has more than 20 years experience in database design and development. Sitaram holds a master's degree in system science and automation from the Indian Institute of Science, India.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/ko\/author\/sitaram-vemulapallicouchbase-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Group by Index | Aggregate Index SQL | Couchbase","description":"\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub294 \ucffc\ub9ac \uc131\ub2a5 \uaddc\ubaa8\ub97c \uac1c\uc120\ud558\uace0 \uc9c0\uc5f0 \uc2dc\uac04\uc744 \uc904\uc5ec JSON\uc6a9 SQL \ucffc\ub9ac \ucc98\ub9ac\ub97c \ub354 \uc27d\uac8c \ub9cc\ub4e4\uc5b4\uc90d\ub2c8\ub2e4.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/ko\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/","og_locale":"ko_KR","og_type":"article","og_title":"Understanding Index Grouping And Aggregation in Couchbase N1QL Query","og_description":"Index grouping and aggregations can improve query performance magnitude and reduce the latencies to make SQL for JSON query processing easier.","og_url":"https:\/\/www.couchbase.com\/blog\/ko\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/","og_site_name":"The Couchbase Blog","article_published_time":"2018-04-04T02:31:02+00:00","article_modified_time":"2025-06-14T06:43:08+00:00","og_image":[{"width":1388,"height":744,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png","type":"image\/png"}],"author":"Sitaram Vemulapalli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sitaram Vemulapalli","Est. reading time":"21\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/"},"author":{"name":"Sitaram Vemulapalli","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ead1d6aa77984d26b03977adca6f174f"},"headline":"Understanding Index Grouping And Aggregation in Couchbase N1QL Query","datePublished":"2018-04-04T02:31:02+00:00","dateModified":"2025-06-14T06:43:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/"},"wordCount":2976,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png","keywords":["aggregates","database","grouping","Index","JSON","NoSQL Database"],"articleSection":["Application Design","Couchbase Server","High Performance","SQL++ \/ N1QL Query"],"inLanguage":"ko-KR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/","url":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/","name":"SQL Group by Index | Aggregate Index SQL | Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png","datePublished":"2018-04-04T02:31:02+00:00","dateModified":"2025-06-14T06:43:08+00:00","description":"\uc778\ub371\uc2a4 \uadf8\ub8f9\ud654 \ubc0f \uc9d1\uacc4\ub294 \ucffc\ub9ac \uc131\ub2a5 \uaddc\ubaa8\ub97c \uac1c\uc120\ud558\uace0 \uc9c0\uc5f0 \uc2dc\uac04\uc744 \uc904\uc5ec JSON\uc6a9 SQL \ucffc\ub9ac \ucc98\ub9ac\ub97c \ub354 \uc27d\uac8c \ub9cc\ub4e4\uc5b4\uc90d\ub2c8\ub2e4.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/"]}]},{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/04\/Screen-Shot-2018-04-03-at-10.08.36-AM.png","width":1388,"height":744},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/understanding-index-grouping-aggregation-couchbase-n1ql-query\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Understanding Index Grouping And Aggregation in Couchbase N1QL Query"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \ube14\ub85c\uadf8","description":"NoSQL \ub370\uc774\ud130\ubca0\uc774\uc2a4, Couchbase","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"\uce74\uc6b0\uce58\ubca0\uc774\uc2a4 \ube14\ub85c\uadf8","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ead1d6aa77984d26b03977adca6f174f","name":"\uc2dc\ud0c0\ub78c \ubca0\ubb3c\ub77c\ud314\ub9ac","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/988725d1a67be1227a105a4071c69e2b","url":"https:\/\/secure.gravatar.com\/avatar\/67edc83f4123b955cf7c20e1c509799b94a1fb14d1aedb3c226b998081714da3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/67edc83f4123b955cf7c20e1c509799b94a1fb14d1aedb3c226b998081714da3?s=96&d=mm&r=g","caption":"Sitaram Vemulapalli"},"description":"Sitaram Vemulapalli\ub294 Couchbase\uc758 \uc218\uc11d \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uc5d4\uc9c0\ub2c8\uc5b4\uc785\ub2c8\ub2e4. Couchbase\uc5d0 \uc785\uc0ac\ud558\uae30 \uc804\uc5d0\ub294 IBM Informix SQL\uc758 \uc544\ud0a4\ud14d\ud2b8\ub85c \uadfc\ubb34\ud588\uc73c\uba70 \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc124\uacc4 \ubc0f \uac1c\ubc1c \ubd84\uc57c\uc5d0\uc11c 20\ub144 \uc774\uc0c1\uc758 \uacbd\ub825\uc744 \uc313\uc558\uc2b5\ub2c8\ub2e4. \uc778\ub3c4 \uc778\ub3c4\uacfc\ud559\uc5f0\uad6c\uc18c\uc5d0\uc11c \uc2dc\uc2a4\ud15c \uacfc\ud559 \ubc0f \uc790\ub3d9\ud654 \uc11d\uc0ac \ud559\uc704\ub97c \ucde8\ub4dd\ud588\uc2b5\ub2c8\ub2e4.","url":"https:\/\/www.couchbase.com\/blog\/ko\/author\/sitaram-vemulapallicouchbase-com\/"}]}},"authors":[{"term_id":9067,"user_id":7586,"is_guest":0,"slug":"sitaram-vemulapallicouchbase-com","display_name":"Sitaram Vemulapalli","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/67edc83f4123b955cf7c20e1c509799b94a1fb14d1aedb3c226b998081714da3?s=96&d=mm&r=g","author_category":"","last_name":"Vemulapalli","first_name":"Sitaram","job_title":"","user_url":"","description":"Sitaram Vemulapalli\ub294 Couchbase\uc758 \uc218\uc11d \uc18c\ud504\ud2b8\uc6e8\uc5b4 \uc5d4\uc9c0\ub2c8\uc5b4\uc785\ub2c8\ub2e4. Couchbase\uc5d0 \uc785\uc0ac\ud558\uae30 \uc804\uc5d0\ub294 IBM Informix SQL\uc758 \uc544\ud0a4\ud14d\ud2b8\ub85c \uadfc\ubb34\ud588\uc73c\uba70 \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc124\uacc4 \ubc0f \uac1c\ubc1c \ubd84\uc57c\uc5d0\uc11c 20\ub144 \uc774\uc0c1\uc758 \uacbd\ub825\uc744 \uc313\uc558\uc2b5\ub2c8\ub2e4. \uc778\ub3c4 \uc778\ub3c4\uacfc\ud559\uc5f0\uad6c\uc18c\uc5d0\uc11c \uc2dc\uc2a4\ud15c \uacfc\ud559 \ubc0f \uc790\ub3d9\ud654 \uc11d\uc0ac \ud559\uc704\ub97c \ucde8\ub4dd\ud588\uc2b5\ub2c8\ub2e4."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/4935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/users\/7586"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/comments?post=4935"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/posts\/4935\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media\/4938"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/media?parent=4935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/categories?post=4935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/tags?post=4935"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/ko\/wp-json\/wp\/v2\/ppma_author?post=4935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}