{"id":10241,"date":"2023-06-23T01:43:43","date_gmt":"2023-06-23T08:43:43","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/understand-index-scans\/"},"modified":"2023-06-23T01:43:43","modified_gmt":"2023-06-23T08:43:43","slug":"understand-index-scans","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/","title":{"rendered":"Understanding Index Scans"},"content":{"rendered":"<p class=\"wp-block-paragraph\">FILTER, JOIN, and PROJECT are fundamental operations of database query processing. The filtering process takes the initial keyspace and produces an optimal subset of the documents the query is interested in. To produce the smallest possible subset, indexes are used to apply as many predicates as possible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Query predicate indicates the subset of the data interested. During the query planning phase, we select the indexes to be used. Then, for each index, we decide the predicates to be applied by each index. The query predicates are translated into spans in the query plan and passed to Indexer. Spans simply express the predicates in terms of data ranges. Where each range has a start value, an end value, and specifies whether to include the start or the end value.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A &#8220;High&#8221; field in the range indicates the end value. If &#8220;High&#8221; is missing, then there is no upper bound.<\/li>\n\n\n<li>A &#8220;Low&#8221; field in the range indicates the start value. If &#8220;Low&#8221; is missing, the scan starts with <code>MISSING<\/code>.<\/li>\n\n\n<li>Inclusion indicates if the values of the High and Low fields are included.<\/li>\n\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Inclusion #<\/th>\n<th align=\"left\">Meaning<\/th>\n<th align=\"left\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">0<\/td>\n<td align=\"left\">NEITHER<\/td>\n<td align=\"left\">Neither High nor Low fields are included<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">1<\/td>\n<td align=\"left\">LOW<\/td>\n<td align=\"left\">Only Low fields are included<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">2<\/td>\n<td align=\"left\">HIGH<\/td>\n<td align=\"left\">Only High fields are included<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">3<\/td>\n<td align=\"left\">BOTH<\/td>\n<td align=\"left\">Both High and Low fields are included<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h3 id=\"h-example-equality-predicate\" class=\"wp-block-heading\">Example: Equality Predicate<\/h3>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT meta().id FROM `travel-sample` WHERE id = 10\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Span Range for<\/th>\n<th align=\"left\">Low<\/th>\n<th align=\"left\">High<\/th>\n<th align=\"left\">Inclusion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">ID = 10<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">3 (BOTH)<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h3 id=\"h-example-inclusive-onesided-range-predicate\" class=\"wp-block-heading\">Example: Inclusive One-Sided Range Predicate<\/h3>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT meta().id FROM `travel-sample` WHERE id &gt;= 10\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Span Range for<\/th>\n<th align=\"left\">Low<\/th>\n<th align=\"left\">High<\/th>\n<th align=\"left\">Inclusion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">ID &gt;= 10<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">Unbounded<\/td>\n<td align=\"left\">1 (LOW)<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h3 id=\"h-example-exclusive-onesided-range-predicate\" class=\"wp-block-heading\">Example: Exclusive One-Sided Range Predicate<\/h3>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT meta().id FROM `travel-sample` WHERE id &gt; 10\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Span Range for<\/th>\n<th align=\"left\">Low<\/th>\n<th align=\"left\">High<\/th>\n<th align=\"left\">Inclusion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">ID &gt; 10<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">Unbounded<\/td>\n<td align=\"left\">0 (NEITHER)<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h3 id=\"h-example-and-predicate\" class=\"wp-block-heading\">Example: AND Predicate<\/h3>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT meta().id FROM `travel-sample` WHERE id &gt;=10 AND id &lt; 25\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Span Range for<\/th>\n<th align=\"left\">Low<\/th>\n<th align=\"left\">High<\/th>\n<th align=\"left\">Inclusion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">ID &gt;= 10 AND ID &lt; 25<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">25<\/td>\n<td align=\"left\">1 (LOW)<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h3 id=\"h-example-or-predicate\" class=\"wp-block-heading\">Example: OR Predicate<\/h3>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT meta().id FROM `travel-sample` WHERE id = 10 OR id = 20\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The predicate produces two independent ranges and both of them are pushed to index scan. Duplicate ranges are eliminated, but overlaps are not eliminated.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Span Range for<\/th>\n<th align=\"left\">Low<\/th>\n<th align=\"left\">High<\/th>\n<th align=\"left\">Inclusion<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">ID = 10<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">3 (BOTH)<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">ID = 20<\/td>\n<td align=\"left\">20<\/td>\n<td align=\"left\">20<\/td>\n<td align=\"left\">3 (BOTH)<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When you analyze the explain plan, correlate the predicates in the explain to the spans. Ensure the most optimal index is selected and the spans have the expected range for all the index keys. More keys in each span will make the query more efficient. Further explanation and many <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/services-and-indexes\/indexes\/index-scans.html\">more detailed examples of index scans<\/a> can be found in our documentation site.<\/p>","protected":false},"excerpt":{"rendered":"<p>FILTER, JOIN, and PROJECT are fundamental operations of database query processing. The filtering process takes the initial keyspace and produces an optimal subset of the documents the query is interested in. To produce the smallest possible subset, indexes are used to apply as many predicates as possible. Query predicate indicates the subset of the data [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"_acf":"","inline_featured_image":false,"footnotes":""},"tutorial-languages":[551],"tutorial-tags":[575,574],"tutorial-technologies":[572,549,554],"tutorial-types":[555],"class_list":["post-10241","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-any","tutorial-tags-optimization","tutorial-tags-sql-n1ql","tutorial-technologies-index","tutorial-technologies-query","tutorial-technologies-server","tutorial-types-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.9 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Understanding Index Scans - Couchbase<\/title>\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\/ko\/developers\/tutorials\/understand-index-scans\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Index Scans\" \/>\n<meta property=\"og:description\" content=\"FILTER, JOIN, and PROJECT are fundamental operations of database query processing. The filtering process takes the initial keyspace and produces an optimal subset of the documents the query is interested in. To produce the smallest possible subset, indexes are used to apply as many predicates as possible. Query predicate indicates the subset of the data [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/\" \/>\n<meta property=\"og:site_name\" content=\"Couchbase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Couchbase\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2548\" \/>\n\t<meta property=\"og:image:height\" content=\"1171\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@couchbase\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/developers\\\/tutorials\\\/understand-index-scans\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/developers\\\/tutorials\\\/understand-index-scans\\\/\",\"name\":\"Understanding Index Scans - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/#website\"},\"datePublished\":\"2023-06-23T08:43:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/developers\\\/tutorials\\\/understand-index-scans\\\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/developers\\\/tutorials\\\/understand-index-scans\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/developers\\\/tutorials\\\/understand-index-scans\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding Index Scans\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"width\":1129,\"height\":1129,\"caption\":\"Couchbase\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/ko\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Couchbase\\\/\",\"https:\\\/\\\/x.com\\\/couchbase\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/CouchbaseServer\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/couchbase\\\/\",\"https:\\\/\\\/github.com\\\/couchbase\\\/\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Couchbase,_Inc.\"],\"description\":\"Couchbase is a database software company headquartered in San Jose, California, providing an operational data platform for AI used by hundreds of global enterprises.\",\"legalName\":\"Couchbase, Inc.\",\"foundingDate\":\"2011-01-01\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Understanding Index Scans - Couchbase","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\/ko\/developers\/tutorials\/understand-index-scans\/","og_locale":"ko_KR","og_type":"article","og_title":"Understanding Index Scans","og_description":"FILTER, JOIN, and PROJECT are fundamental operations of database query processing. The filtering process takes the initial keyspace and produces an optimal subset of the documents the query is interested in. To produce the smallest possible subset, indexes are used to apply as many predicates as possible. Query predicate indicates the subset of the data [&hellip;]","og_url":"https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/","og_site_name":"Couchbase","article_publisher":"https:\/\/www.facebook.com\/Couchbase\/","og_image":[{"width":2548,"height":1171,"url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@couchbase","twitter_misc":{"Est. reading time":"2\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/","url":"https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/","name":"Understanding Index Scans - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/ko\/#website"},"datePublished":"2023-06-23T08:43:43+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/ko\/developers\/tutorials\/understand-index-scans\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/ko\/"},{"@type":"ListItem","position":2,"name":"Understanding Index Scans"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/ko\/#website","url":"https:\/\/www.couchbase.com\/ko\/","name":"\ucf54\uc6b0\uce58\ubca0\uc774\uc2a4","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/ko\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/ko\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/ko\/#organization","name":"\ucf54\uc6b0\uce58\ubca0\uc774\uc2a4","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/ko\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.couchbase.com\/ko\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","contentUrl":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","width":1129,"height":1129,"caption":"Couchbase"},"image":{"@id":"https:\/\/www.couchbase.com\/ko\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Couchbase\/","https:\/\/x.com\/couchbase","https:\/\/www.youtube.com\/c\/CouchbaseServer","https:\/\/www.linkedin.com\/company\/couchbase\/","https:\/\/github.com\/couchbase\/","https:\/\/en.wikipedia.org\/wiki\/Couchbase,_Inc."],"description":"Couchbase\ub294 \uce98\ub9ac\ud3ec\ub2c8\uc544\uc8fc \uc0cc\ud638\uc138\uc5d0 \ubcf8\uc0ac\ub97c \ub454 \ub370\uc774\ud130\ubca0\uc774\uc2a4 \uc18c\ud504\ud2b8\uc6e8\uc5b4 \ud68c\uc0ac\ub85c, \uc218\ubc31 \uac1c\uc758 \uae00\ub85c\ubc8c \uae30\uc5c5\uc5d0\uc11c \ud65c\uc6a9\ud558\ub294 \uc778\uacf5\uc9c0\ub2a5\uc744 \uc704\ud55c \uc6b4\uc601 \ub370\uc774\ud130 \ud50c\ub7ab\ud3fc\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/tutorials\/10241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/tutorials\/10241\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/media?parent=10241"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/tutorial-languages?post=10241"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/tutorial-tags?post=10241"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/tutorial-technologies?post=10241"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/ko\/wp-json\/wp\/v2\/tutorial-types?post=10241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}