{"id":10244,"date":"2023-06-23T01:43:43","date_gmt":"2023-06-23T08:43:43","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/understanding-cardinality-and-selectivity\/"},"modified":"2023-06-23T01:43:43","modified_gmt":"2023-06-23T08:43:43","slug":"understanding-cardinality-and-selectivity","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/","title":{"rendered":"Understanding Cardinality and Selectivity"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Cardinality and selectivity play a crucial role in index tuning and optimization as they can provide measurable insights into your data set and effectiveness of the index, pointing you to where specific optimizations can be made.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/en.wikipedia.org\/wiki\/Cardinality_%28SQL_statements%29\">Cardinality<\/a> refers to the individual uniqueness of values in a specific index key. Each index key (document property) emitted into the index will have varying degrees of cardinality. Cardinality can be broken down into roughly 3 different types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>High-Cardinality<\/em>: Refers to values that are unique or very uncommon within the index key. Examples include fields such as GUIDs, IDs, email addresses, and usernames.<\/li>\n\n\n<li><em>Normal-Cardinality<\/em>: Refers to values that are somewhat uncommon but not necessarily unique within the index key. Examples include: <strong>first<\/strong> \/ <strong>middle<\/strong> \/ <strong>last name<\/strong>, <strong>zip codes<\/strong>. There are last names \/ surnames that very well may be unique in the data set, however, if you were to examine all of the distinct values you&#8217;ll find groupings of certain values (i.e. Jones).<\/li>\n\n\n<li><em>Low-Cardinality<\/em>: Refers to values that are common within the data set and have very few possible values. Examples include status, gender, and booleans. Fields that have little uniqueness and are common across the index, examples are status, gender, and booleans.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Selectivity is the measure of variation in unique values in a given data set and it is represented as a number between <code>0 - 1<\/code> or <code>0 - 100%<\/code>. The formula to calculate selectivity can be represented as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code>selectivity = cardinality\/(number of records) * 100\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">or more simply stated:<\/p>\n\n\n\n<pre class=\"wp-block-code language-bash\"><code>Number of Distinct Values \/ Total number of Records = Selectivity\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Cardinality and Selectivity can be applied to any &#8220;data set&#8221; such as an index, query or bucket. In general for database indexes, the higher cardinality -&gt; better selectivity -&gt; faster scans -&gt; increased performance. Consider the table below:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"right\"><\/th>\n<th align=\"left\">Name<\/th>\n<th align=\"left\">Breed<\/th>\n<th align=\"left\">Gender<\/th>\n<th align=\"left\">Origin Country<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"right\">1<\/td>\n<td align=\"left\">Oakley<\/td>\n<td align=\"left\">German Shepherd<\/td>\n<td align=\"left\">M<\/td>\n<td align=\"left\">Germany<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">2<\/td>\n<td align=\"left\">Zeus<\/td>\n<td align=\"left\">Doberman Pinscher<\/td>\n<td align=\"left\">M<\/td>\n<td align=\"left\">Germany<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">3<\/td>\n<td align=\"left\">Darby<\/td>\n<td align=\"left\">Doberman Pinscher<\/td>\n<td align=\"left\">F<\/td>\n<td align=\"left\">Germany<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">4<\/td>\n<td align=\"left\">Rocky<\/td>\n<td align=\"left\">Bulldog<\/td>\n<td align=\"left\">M<\/td>\n<td align=\"left\">United Kingdom<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">5<\/td>\n<td align=\"left\">Lucy<\/td>\n<td align=\"left\">Labrador Retriever<\/td>\n<td align=\"left\">F<\/td>\n<td align=\"left\">Canada<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">6<\/td>\n<td align=\"left\">Buddy<\/td>\n<td align=\"left\">Golden Retriever<\/td>\n<td align=\"left\">M<\/td>\n<td align=\"left\">United Kingdom<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">7<\/td>\n<td align=\"left\">Molly<\/td>\n<td align=\"left\">Pug<\/td>\n<td align=\"left\">F<\/td>\n<td align=\"left\">China<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">8<\/td>\n<td align=\"left\">Sadie<\/td>\n<td align=\"left\">Labrador Retriever<\/td>\n<td align=\"left\">F<\/td>\n<td align=\"left\">Canada<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">9<\/td>\n<td align=\"left\">Max<\/td>\n<td align=\"left\">Boxer<\/td>\n<td align=\"left\">M<\/td>\n<td align=\"left\">Germany<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">10<\/td>\n<td align=\"left\">Simba<\/td>\n<td align=\"left\">Great Dane<\/td>\n<td align=\"left\">M<\/td>\n<td align=\"left\">Germany<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">Cardinality<\/td>\n<td align=\"left\">10<\/td>\n<td align=\"left\">6<\/td>\n<td align=\"left\">2<\/td>\n<td align=\"left\">4<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">Selectivity<\/td>\n<td align=\"left\">100%<\/td>\n<td align=\"left\">60%<\/td>\n<td align=\"left\">20%<\/td>\n<td align=\"left\">40%<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h3 id=\"h-examples\" class=\"wp-block-heading\">Examples<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Using the <code>travel-sample<\/code> bucket, we&#8217;ll calculate two selectivity values for some of the sample indexes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>Projection Selectivity<\/em>: This is a measure of the # of documents in the bucket that match the index filter\/<code>WHERE<\/code> predicate and contain the leading field. This is often referred to as &#8220;index segmentation&#8221;.<\/li>\n\n\n<li><em>Index Selectivity<\/em>: This is a measure of the number of unique values in the index compared to the total # of entries in the index.<\/li>\n\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">For optimum performance, you will want a relatively low percentage of Projection Selectivity as this means the index is smaller, and a higher value for Index selectivity as this means there is a lot of uniqueness within the index.<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Initially, we need to get the total # of documents in the bucket, as we will reuse this value in all of our calculations:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(1)\nFROM `travel-sample`\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[31591]\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-example-1-codedeftypecode-index\" class=\"wp-block-heading\">Example 1: <code>def_type<\/code> index<\/h4>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>CREATE INDEX `def_type` ON `travel-sample`(`type`)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Determine the total number of records in the index, this query will push the <code>COUNT()<\/code> down to the indexer, and we trigger the use of the index by referencing the first field in the index. If needed you could optionally specify a <code>USE INDEX()<\/code> statement to ensure the index is used:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT COUNT(1)\nFROM `travel-sample`\nWHERE type IS NOT MISSING\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[31591]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we need to determine the total number of possible unique values in the index:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(DISTINCT type)\nFROM `travel-sample`\nWHERE type IS NOT MISSING\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[5]\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Description<\/th>\n<th align=\"left\">Formula<\/th>\n<th align=\"left\">Selectivity<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">Projection Selectivity<\/td>\n<td align=\"left\">(31591 \/ 31591) * 100<\/td>\n<td align=\"left\">100%<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Index Selectivity<\/td>\n<td align=\"left\">(5 \/ 31591) * 100<\/td>\n<td align=\"left\">0.015%<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h4 id=\"h-example-2-codedeffaacode-index\" class=\"wp-block-heading\">Example 2: <code>def_faa<\/code> index<\/h4>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>CREATE INDEX `def_faa` ON `travel-sample`(`faa`)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Determine the total number of records in the index:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(1)\nFROM `travel-sample`\nWHERE faa IS NOT MISSING\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[1968]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we need to determine the total number of possible unique values in the index:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(DISTINCT faa)\nFROM `travel-sample`\nWHERE faa IS NOT MISSING\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[1708]\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Description<\/th>\n<th align=\"left\">Formula<\/th>\n<th align=\"left\">Selectivity<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">Projection Selectivity<\/td>\n<td align=\"left\">(1968 \/ 31591) * 100<\/td>\n<td align=\"left\">6.23%<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Index Selectivity<\/td>\n<td align=\"left\">(1708 \/ 1968) * 100<\/td>\n<td align=\"left\">86.79%<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h4 id=\"h-example-3-codedefcountrycode-index\" class=\"wp-block-heading\">Example 3: <code>def_country<\/code> index<\/h4>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>CREATE INDEX `def_country` ON `travel-sample`(`country`, `type`)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Determine the total number of records in the index:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(1)\nFROM `travel-sample`\nWHERE country IS NOT MISSING\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[7567]\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we need to determine the total number of possible unique values in the index. For this example, however, there are two index keys <code>country<\/code> and <code>type<\/code>. The selectivity depends on how the index will be used and when optimizing it is important to understand how the cardinality of one key can affect the other.<\/p>\n\n\n\n<h5 id=\"h-example-3-a\" class=\"wp-block-heading\">Example 3.a<\/h5>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT *\nFROM `travel-sample`\nWHERE country = &#039;United States&#039;\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(DISTINCT country)\nFROM `travel-sample`\nWHERE country IS NOT MISSING\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[3]\n<\/code><\/pre>\n\n\n\n<h5 id=\"h-example-3-b\" class=\"wp-block-heading\">Example 3.b<\/h5>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT *\nFROM `travel-sample`\nWHERE country = &#039;United States&#039; AND type = &#039;landmark&#039;\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When both keys are used, the selectivity can be described in two ways, the first is the total uniqueness of both keys when combined together:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(DISTINCT country || type)\nFROM `travel-sample`\nWHERE country IS NOT MISSING\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[12]\n<\/code><\/pre>\n\n\n\n<h5 id=\"h-example-3-c\" class=\"wp-block-heading\">Example 3.c<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">The second is # of unique keys for the second index key which matches the previous index key:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(1)\nFROM `travel-sample`\nWHERE country = &#039;United States&#039;\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[3948]\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT RAW COUNT(DISTINCT type)\nFROM `travel-sample`\nWHERE country = &#039;United States&#039;\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>[4]\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<thead>\n<tr>\n<th align=\"left\">Description<\/th>\n<th align=\"left\">Formula<\/th>\n<th align=\"left\">Selectivity<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">Projection Selectivity<\/td>\n<td align=\"left\">(7567 \/ 31591) * 100<\/td>\n<td align=\"left\">23.95%<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Index Selectivity (3.a)<\/td>\n<td align=\"left\">(3 \/ 7567) * 100<\/td>\n<td align=\"left\">0.039%<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Index Selectivity (3.b)<\/td>\n<td align=\"left\">(12 \/ 7567) * 100<\/td>\n<td align=\"left\">0.16%<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">Index Selectivity (3.c)<\/td>\n<td align=\"left\">(4 \/ 3948) * 100<\/td>\n<td align=\"left\">0.10%<\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h3 id=\"h-summary\" class=\"wp-block-heading\">Summary<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Both cardinality and selectivity can affect the performance of IndexScans, and you should always consider their implications as it relates to your access patterns and query predicates. Having a solid understanding of cardinality and selectivity as it relates to your data set can provide solid guidance in the tuning and determining the order of index keys within the index.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cardinality and selectivity play a crucial role in index tuning and optimization as they can provide measurable insights into your data set and effectiveness of the index, pointing you to where specific optimizations can be made. Cardinality refers to the individual uniqueness of values in a specific index key. Each index key (document property) emitted [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_acf":"","footnotes":""},"tutorial-languages":[551],"tutorial-tags":[575,574],"tutorial-technologies":[549,554],"tutorial-types":[555],"class_list":["post-10244","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-any","tutorial-tags-optimization","tutorial-tags-sql-n1ql","tutorial-technologies-query","tutorial-technologies-server","tutorial-types-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Understanding Cardinality and Selectivity - 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\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding Cardinality and Selectivity\" \/>\n<meta property=\"og:description\" content=\"Cardinality and selectivity play a crucial role in index tuning and optimization as they can provide measurable insights into your data set and effectiveness of the index, pointing you to where specific optimizations can be made. Cardinality refers to the individual uniqueness of values in a specific index key. Each index key (document property) emitted [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/\" \/>\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=\"5 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/understanding-cardinality-and-selectivity\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/understanding-cardinality-and-selectivity\\\/\",\"name\":\"Understanding Cardinality and Selectivity - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\"},\"datePublished\":\"2023-06-23T08:43:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/understanding-cardinality-and-selectivity\\\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/understanding-cardinality-and-selectivity\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/understanding-cardinality-and-selectivity\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding Cardinality and Selectivity\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/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\\\/it\\\/#\\\/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 Cardinality and Selectivity - 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\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/","og_locale":"it_IT","og_type":"article","og_title":"Understanding Cardinality and Selectivity","og_description":"Cardinality and selectivity play a crucial role in index tuning and optimization as they can provide measurable insights into your data set and effectiveness of the index, pointing you to where specific optimizations can be made. Cardinality refers to the individual uniqueness of values in a specific index key. Each index key (document property) emitted [&hellip;]","og_url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/","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":"5 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/","url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/","name":"Understanding Cardinality and Selectivity - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/it\/#website"},"datePublished":"2023-06-23T08:43:43+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/understanding-cardinality-and-selectivity\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"Understanding Cardinality and Selectivity"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/it\/#website","url":"https:\/\/www.couchbase.com\/it\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/it\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/it\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/it\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/it\/","logo":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.couchbase.com\/it\/#\/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\/it\/#\/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 \u00e8 una societ\u00e0 di software per database con sede a San Jose, in California, che fornisce una piattaforma operativa per i dati utilizzata da centinaia di aziende globali.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10244\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/media?parent=10244"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-languages?post=10244"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-tags?post=10244"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-technologies?post=10244"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-types?post=10244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}