{"id":2048,"date":"2015-12-21T09:05:00","date_gmt":"2015-12-21T09:05:00","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2048"},"modified":"2015-12-21T09:05:00","modified_gmt":"2015-12-21T09:05:00","slug":"introduction-to-covering-indexes","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/introduction-to-covering-indexes\/","title":{"rendered":"Introducci\u00f3n a los \u00edndices de cobertura"},"content":{"rendered":"<h2>\u00bfQu\u00e9 son los \u00edndices de cobertura?<\/h2>\n<p>En el mundo relacional\/SQL se puede ahorrar tiempo de consulta mediante el uso juicioso de \u00edndices: si se tiene un \u00edndice en cada columna que toca la consulta, el SGBD puede devolver los resultados sin bucear en las propias tablas.<\/p>\n<p>Se trata de \u00edndices de cobertura.<\/p>\n<h2>\u00bfQu\u00e9 son los \u00edndices de cobertura en Couchbase?<\/h2>\n<p>Couchbase Server 4.1 trae \u00edndices de cobertura a N1QL. Si tienes un \u00edndice que cubre todos los datos requeridos por tu consulta N1QL, Couchbase Server puede devolver los datos directamente desde ese \u00edndice. Esto reduce al menos una, y posiblemente varias, lecturas de documentos del proceso de consulta.<\/p>\n<h2 style=\"margin-top: 0.7em; color: rgb(51, 51, 51); text-align: left;\">\u00bfC\u00f3mo funciona?<\/h2>\n<p>Cuando env\u00edas una consulta N1QL a Couchbase, \u00e9sta pasa por los siguientes pasos:<\/p>\n<ol>\n<li>Analiza la consulta, lo que hace y crea un plan de consulta.<\/li>\n<li>Comprueba los \u00edndices correspondientes.<\/li>\n<li>Obtiene las claves de los documentos que contienen los resultados y, a continuaci\u00f3n, obtiene los documentos propiamente dichos.<\/li>\n<li>Extrae los datos pertinentes de esos documentos para crear el resultado.<\/li>\n<li>Devuelve el resultado a su aplicaci\u00f3n.<\/li>\n<\/ol>\n<p>Con un \u00edndice de cobertura, todos los datos del resultado se encuentran en el propio \u00edndice, por lo que se eliminan los pasos 3 y 4.<\/p>\n<h2>\u00bfC\u00f3mo se utilizan los \u00edndices de cobertura?<\/h2>\n<p>No cambia nada en la forma de escribir las consultas. Se trata m\u00e1s bien de c\u00f3mo configurar los \u00edndices. Un \u00fanico \u00edndice - GSI o vista - debe cubrir cada clave JSON que toque tu consulta.<\/p>\n<h2 style=\"margin-top: 0.7em; color: rgb(51, 51, 51); text-align: left;\">\u00bfTienes un ejemplo?<\/h2>\n<p>Supongamos que almacenamos perfiles de clientes. Podr\u00edan tener este aspecto:<\/p>\n<p>{<\/p>\n<p style=\"margin-left: 40px;\">\"Nombre\": \"Sherlock Holmes\",<\/p>\n<p style=\"margin-left: 40px;\">\"Direcci\u00f3n\": \"221b Baker Street\",<\/p>\n<p style=\"margin-left: 40px;\">\"ciudad\": \"Londres\",<\/p>\n<p style=\"margin-left: 40px;\">\"country\": \"REINO UNIDO\",<\/p>\n<p style=\"margin-left: 40px;\">\"newsletter\": true,<\/p>\n<p style=\"margin-left: 40px;\">\"joinedDate\": 1168041600<\/p>\n<p>}<\/p>\n<p>Si quisi\u00e9ramos encontrar el nombre y la ciudad de todas las personas suscritas a nuestro bolet\u00edn, podr\u00edamos escribir una consulta N1QL como \u00e9sta:<\/p>\n<pre>\nSELECT name, city FROM `customers` WHERE newsletter=true;<\/pre>\n<p>Sin un \u00edndice de cobertura, esta consulta sacar\u00eda <em>nombre<\/em> y <em>ciudad\u00a0<\/em>de nuestros registros de clientes haciendo una b\u00fasqueda de esos documentos.<\/p>\n<p>Podemos crear un \u00edndice de cobertura para esta consulta de la siguiente manera:<\/p>\n<pre>\nCREATE INDEX newsletter_subs ON `customers`(name, city, newsletter) USING GSI;<\/pre>\n<p>Ahora la consulta puede satisfacerse \u00edntegramente a partir del \u00edndice.<\/p>\n<h2>\u00bfD\u00f3nde puedo leer m\u00e1s?<\/h2>\n<p>Hay un <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/4.1\/indexes\/covering-indexes.html\">secci\u00f3n sobre \u00edndices de cobertura en la documentaci\u00f3n de Couchbase Server<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>What are covering indexes? In the relational\/SQL world you\u00a0can save query time by the judicious use of indexes: if you have an index on each column that your query touches then your DBMS can return the results without diving into [&hellip;]<\/p>","protected":false},"author":18,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[8982],"class_list":["post-2048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.2 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Introduction to covering indexes - The Couchbase Blog<\/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\/blog\/es\/introduction-to-covering-indexes\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to covering indexes\" \/>\n<meta property=\"og:description\" content=\"What are covering indexes? In the relational\/SQL world you\u00a0can save query time by the judicious use of indexes: if you have an index on each column that your query touches then your DBMS can return the results without diving into [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/introduction-to-covering-indexes\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-21T09:05:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/\"},\"author\":{\"name\":\"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/6c3060a94353df62a71d4672b3454555\"},\"headline\":\"Introduction to covering indexes\",\"datePublished\":\"2015-12-21T09:05:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/\"},\"wordCount\":359,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/\",\"name\":\"Introduction to covering indexes - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2015-12-21T09:05:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction to covering indexes\"}]},{\"@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\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@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\/6c3060a94353df62a71d4672b3454555\",\"name\":\"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/b1bc555cd9166b46d6063003c3b92317\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3b38ea45b78371f0008a765ea828bfed91aa97c25981ebf214226402a510b39b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3b38ea45b78371f0008a765ea828bfed91aa97c25981ebf214226402a510b39b?s=96&d=mm&r=g\",\"caption\":\"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase\"},\"description\":\"Matthew Revell is a Lead Dev Advocate, EMEA Couchbase. He developed a global strategy for putting Couchbase front in the minds of the product's developers.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/matthew-revell\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Introduction to covering indexes - The Couchbase Blog","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\/es\/introduction-to-covering-indexes\/","og_locale":"es_MX","og_type":"article","og_title":"Introduction to covering indexes","og_description":"What are covering indexes? In the relational\/SQL world you\u00a0can save query time by the judicious use of indexes: if you have an index on each column that your query touches then your DBMS can return the results without diving into [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/es\/introduction-to-covering-indexes\/","og_site_name":"The Couchbase Blog","article_published_time":"2015-12-21T09:05:00+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase","Est. reading time":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/"},"author":{"name":"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/6c3060a94353df62a71d4672b3454555"},"headline":"Introduction to covering indexes","datePublished":"2015-12-21T09:05:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/"},"wordCount":359,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Uncategorized"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/","url":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/","name":"Introduction to covering indexes - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2015-12-21T09:05:00+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/introduction-to-covering-indexes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Introduction to covering indexes"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","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":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@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\/6c3060a94353df62a71d4672b3454555","name":"Matthew Revell, Defensor principal del desarrollador, EMEA, Couchbase","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/b1bc555cd9166b46d6063003c3b92317","url":"https:\/\/secure.gravatar.com\/avatar\/3b38ea45b78371f0008a765ea828bfed91aa97c25981ebf214226402a510b39b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3b38ea45b78371f0008a765ea828bfed91aa97c25981ebf214226402a510b39b?s=96&d=mm&r=g","caption":"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase"},"description":"Matthew Revell es Lead Dev Advocate, EMEA Couchbase. Ha desarrollado una estrategia global para situar a Couchbase en la mente de los desarrolladores del producto.","url":"https:\/\/www.couchbase.com\/blog\/es\/author\/matthew-revell\/"}]}},"authors":[{"term_id":8982,"user_id":18,"is_guest":0,"slug":"matthew-revell","display_name":"Matthew Revell, Lead Developer Advocate, EMEA, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/3b38ea45b78371f0008a765ea828bfed91aa97c25981ebf214226402a510b39b?s=96&d=mm&r=g","author_category":"","last_name":"Revell","first_name":"Matthew","job_title":"","user_url":"","description":"Matthew Revell es Lead Dev Advocate, EMEA Couchbase. Ha desarrollado una estrategia global para situar a Couchbase en la mente de los desarrolladores del producto."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/2048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=2048"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/2048\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=2048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=2048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=2048"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=2048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}