{"id":6029,"date":"2018-11-22T21:12:20","date_gmt":"2018-11-23T05:12:20","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=6029"},"modified":"2025-06-13T20:19:54","modified_gmt":"2025-06-14T03:19:54","slug":"on-par-with-window-functions-in-n1ql","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/on-par-with-window-functions-in-n1ql\/","title":{"rendered":"A la par con las funciones de ventana."},"content":{"rendered":"<blockquote><p><span style=\"font-weight: 400\">Utilice la analog\u00eda del golf cuando explique a los ejecutivos.<\/span><br \/>\n<span style=\"font-weight: 400\">Utiliza una analog\u00eda automovil\u00edstica para todos los dem\u00e1s.  - Confucio. <\/span><\/p><\/blockquote>\n<p><span style=\"font-weight: 400\">El prop\u00f3sito de las funciones de ventana es traducir los requisitos de los informes empresariales de forma declarativa y eficaz a SQL, de modo que el rendimiento de las consultas y la eficiencia del desarrollador\/analista empresarial mejoren dr\u00e1sticamente. He visto informes y cuadros de mando del mundo real pasar de horas a minutos, de minutos a segundos despu\u00e9s de utilizar funciones de ventana.  El tama\u00f1o de las consultas disminuye de 40 p\u00e1ginas a unas pocas. En los a\u00f1os 90, la base de datos Redbrick comprendi\u00f3 realmente el caso de uso empresarial y cre\u00f3 una nueva capa de funcionalidad para realizar informes empresariales que inclu\u00edan clasificaciones, totales de ejecuci\u00f3n, c\u00e1lculo de comisiones e inventario basados en subgrupos, posiciones, etc. Estos han estado en SQL est\u00e1ndar en 2003.  Cada capa de BI (como Tableau, Looker, Cognos) explota esta funcionalidad.<\/span><\/p>\n<p><b>Introducci\u00f3n a las funciones de ventana<\/b><\/p>\n<p><span style=\"font-weight: 400\">Imagina que tienes las puntuaciones de seis golfistas a lo largo de dos rondas. Ahora, necesitas crear la tabla de clasificaci\u00f3n y clasificarlos. Clasif\u00edquelos utilizando SQL.<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">Jugador<\/span><\/td>\n<td><span style=\"font-weight: 400\">Ronda 1<\/span><\/td>\n<td><span style=\"font-weight: 400\">Ronda2<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Marco<\/span><\/td>\n<td><span style=\"font-weight: 400\">75<\/span><\/td>\n<td><span style=\"font-weight: 400\">73<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Johan<\/span><\/td>\n<td><span style=\"font-weight: 400\">72<\/span><\/td>\n<td><span style=\"font-weight: 400\">68<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Chang<\/span><\/td>\n<td><span style=\"font-weight: 400\">67<\/span><\/td>\n<td><span style=\"font-weight: 400\">76<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Isha<\/span><\/td>\n<td><span style=\"font-weight: 400\">74<\/span><\/td>\n<td><span style=\"font-weight: 400\">71<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Sitaram<\/span><\/td>\n<td><span style=\"font-weight: 400\">68<\/span><\/td>\n<td><span style=\"font-weight: 400\">72<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Bingjie<\/span><\/td>\n<td><span style=\"font-weight: 400\">71<\/span><\/td>\n<td><span style=\"font-weight: 400\">67<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Inserte los datos en Couchbase.<\/p>\n<pre class=\"theme:github whitespace-before:2 whitespace-after:2 lang:plsql decode:true\" title=\"Insertar datos en Couchbase.\">INSERT INTO golf\r\nVALUES(\"KP1\", {\"jugador\": \"Marco\", \"ronda1\":75, \"ronda2\":73}),\r\nVALUES(\"KP2\", {\"jugador\": \"Johan\", \"ronda1\":72, \"ronda2\":68}),\r\nVALORES(\"KP3\", {\"jugador\": \"Chang\", \"ronda1\":67, \"ronda2\":76}),\r\nVALORES(\"KP4\", {\"jugador\": \"Isha\", \"ronda1\":74, \"ronda2\":71}),\r\nVALORES(\"KP5\", {\"jugador\": \"Sitaram\", \"ronda1\":68, \"ronda2\":72}),\r\nVALORES(\"KP6\", {\"jugador\": \"Bingjie\", \"ronda1\":71, \"ronda2\":67});\r\n\r\n<\/pre>\n<p><span style=\"font-weight: 400;color: #0000ff\">SIN funciones de ventana (estado actual - Couchbase 6.0)<\/span><\/p>\n<p><span style=\"font-weight: 400\">Para escribir la consulta sin utilizar funciones de ventana, se necesita una subconsulta para calcular la clasificaci\u00f3n de cada jugador.  Esta subconsulta tiene que escanear todos los datos<\/span><span style=\"font-weight: 400\">\u00a0resultando la peor complejidad algor\u00edtmica de <\/span><b>O(N^2), <\/b><span style=\"font-weight: 400\">lo que aumenta dr\u00e1sticamente el tiempo de ejecuci\u00f3n y el rendimiento.<\/span><\/p>\n<pre class=\"theme:github whitespace-before:2 whitespace-after:2 lang:plsql decode:true\" title=\"Consulta RANK sin funciones de ventana\">WITH g1 as (select jugador, ronda1, ronda2 from golf)\r\nSELECT g3.jugador COMO jugador,\r\n          (g3.round1+g3.round2) COMO T,\r\n          ((g3.round1+g3.round2) - 144)            AS ToPar,\r\n          (select raw 1+COUNT(*)\r\n             from g1 as g2\r\n               where (g2.round1 + g2.round2) &lt;\r\n                     (g3.round1 + g3.round2))[0] AS sqlrankR2\r\nFROM g1 as g3\r\nORDER BY sqlrankR2\r\n\r\nResultados:\r\nT ToPar jugador sqlrankR2\r\n138 -6 &quot;Bingjie&quot; 1\r\n140 -4 &quot;Johan&quot; 2\r\n140 -4 &quot;Sitaram&quot; 2\r\n143 -1 &quot;Chang&quot; 4\r\n145 1 &quot;Isha&quot; 5\r\n148 4 Marco 6\r\n<\/pre>\n<p><span style=\"font-weight: 400;color: #0000ff\">Con funciones de ventana en Mad-Hatter (pr\u00f3xima versi\u00f3n)<\/span><\/p>\n<p><span style=\"font-weight: 400\">Esta consulta devuelve jugador, total despu\u00e9s de dos rondas (T), c\u00f3mo de la puntuaci\u00f3n es sobre \/ bajo par (ToPar) y luego <\/span><b>clasifica<\/b> <span style=\"font-weight: 400\">bas\u00e1ndose en las puntuaciones de las dos primeras rondas.  Esta es la NUEVA funcionalidad de Mad-Hatter. La complejidad temporal de esto es O(N), lo que significa que el tiempo de ejecuci\u00f3n s\u00f3lo aumentar\u00e1 linealmente. \u00a0<\/span><\/p>\n<pre class=\"theme:github tab-size:2 whitespace-before:2 whitespace-after:2 lang:plsql decode:true\" title=\"Clasifique la consulta mediante la funci\u00f3n de ventana, RANK().\">SELECCIONE jugador COMO jugador,\r\n          (ronda1+ronda2) COMO T,\r\n          ((ronda1+ronda2) - 144)               AS ToPar,\r\n          RANK() OVER(ORDER BY (round1+round2)) COMO rankR2\r\nFROM golf;\r\n\r\n\r\nT ToPar jugador rankR2\r\n138 -6 \"Bingjie\" 1\r\n140 -4 \"Johan\" 2\r\n140 -4 \"Sitaram\" 2\r\n143 -1 \"Chang\" 4\r\n145 1 \"Isha\" 5\r\n148 4 Marco 6\r\n<\/pre>\n<p><b>Observaciones:<\/b><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">La consulta expresa los requisitos de forma sencilla y clara.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">El rendimiento de esta consulta en un escenario real es mucho mejor.  Tenemos previsto medir.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Cuando los requisitos de clasificaci\u00f3n dependen de varios documentos, la consulta se vuelve bastante compleja de escribir, optimizar y ejecutar.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Todo ello afecta al coste total de propiedad.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">Ahora, vamos a crear un cuadro de mandos ampliado.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Mostrar a\u00f1adir denso rango, n\u00famero de fila, que est\u00e1 por delante, y el n\u00famero de golpes detr\u00e1s del l\u00edder.  Todas cosas muy comunes en una resituaci\u00f3n de reporte. Est\u00e1s viendo la nueva funci\u00f3n de ventana cada vez que ves la cl\u00e1usula OVER().  La consulta de abajo tiene seis funciones ventana. <\/span><\/p>\n<pre class=\"theme:github whitespace-before:2 whitespace-after:2 lang:plsql decode:true\">SELECCIONE jugador COMO jugador,\r\n          (ronda1+ronda2) COMO T,\r\n          ((ronda1+ronda2) - 144)               AS ToPar,\r\n          RANK() OVER(ORDER BY (round1+round2)) AS rankR2,\r\n          DENSE_RANK() OVER (ORDER BY (round1+round2)) AS rankR2Dense,\r\n          ROW_NUMBER() OVER() rownum,\r\n          ((ronda1+ronda2) -\r\n              FIRST_VALUE(ronda1+ronda2)\r\n                OVER(ORDER BY (round1+round2))) AS strokesbehind,\r\n          RANK() OVER(ORDER BY (round1)) AS rankR1,\r\n          LAG(jugador, 1, \"Ninguno\") OVER(ORDER BY ronda1+ronda2)\r\n                                                COMO inFront\r\nFROM golf\r\nORDER BY rankR2\r\n\r\n\r\nT ToPar inFront jugador rankR1 rankR2 rankR2Dense rownum strokesbehind\r\n138 -6 \"Ninguno\" \"Bingjie\" 3 1 1 3 0\r\n140 -4 \"Johan\" \"Sitaram\" 2 2 2 2 2\r\n140 -4 \"Bingjie\" \"Johan\" 4 2 2 4 2\r\n143 -1 \"Sitaram\" \"Chang\" 1 4 3 1 5\r\n145 1 \"Chang\" \"Isha\" 5 5 4 5 7\r\n148 4 \"Isha\" \"Marco\" 6 6 5 6 10\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Como has visto antes, haciendo esta consulta con <\/span><b>seis funciones de ventana mediante<\/b><span style=\"font-weight: 400\"> m\u00e9todo de subconsulta ser\u00e1 una consulta de mayor esfuerzo, costosa y propensa a errores.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Adem\u00e1s de convertir los agregados incorporados (COUNT, SUM, AVG, etc) en funciones ventana, Sitaram ha a\u00f1adido las siguientes funciones ventana.  La sintaxis y la sem\u00e1ntica de cada una de ellas est\u00e1n bien definidas en la norma y bien descritas en los art\u00edculos de la secci\u00f3n de referencia que figura a continuaci\u00f3n.<\/span><\/p>\n<p><b>RANGO()<\/b><b><br \/>\n<\/b><b>DENSE_RANK()<\/b><b><br \/>\n<\/b><b>PERCENT_RANK()<\/b><b><br \/>\n<\/b><b>CUME_DIST()<\/b><b><br \/>\n<\/b><b>NTILE()<\/b><b><br \/>\n<\/b><b>RATIO_TO_REPORT()<\/b><b><br \/>\n<\/b><b>ROW_NUMBER()<\/b><b><br \/>\n<\/b><b>LAG()<\/b><b><br \/>\n<\/b><b>PRIMER_VALOR()<\/b><b><br \/>\n<\/b><b>\u00daLTIMO_VALOR()<\/b><b><br \/>\n<\/b><b>NTH_VALUE()<\/b><b><br \/>\n<\/b><b>LEAD()<\/b><b><\/b><\/p>\n<p><b>Referencias:<\/b><\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Probablemente la funci\u00f3n SQL m\u00e1s interesante: Funciones de ventana. <\/span><a href=\"https:\/\/blog.jooq.org\/2013\/11\/03\/probably-the-coolest-sql-feature-window-functions\/\"><span style=\"font-weight: 400\">https:\/\/blog.jooq.org\/2013\/11\/03\/probably-the-coolest-sql-feature-window-functions\/<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Una ventana al mundo de las funciones anal\u00edticas. <\/span><a href=\"https:\/\/blogs.oracle.com\/oraclemagazine\/a-window-into-the-world-of-analytic-functions\"><span style=\"font-weight: 400\">https:\/\/blogs.oracle.com\/oraclemagazine\/a-window-into-the-world-of-analytic-functions<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Referencia Oracle: <\/span><a href=\"https:\/\/docs.oracle.com\/cd\/E11882_01\/server.112\/e41084\/functions004.htm#SQLRF06174\"><span style=\"font-weight: 400\">https:\/\/docs.oracle.com\/cd\/E11882_01\/server.112\/e41084\/functions004.htm#SQLRF06174<\/span><\/a><\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>Use golf analogy when explaining to executives. Use a car analogy for all others. \u00a0&#8212; Confucius. The purpose of window functions is to translate the business reporting requirements declaratively and effectively to SQL so query performance and developer\/business-analyst efficiency improve [&hellip;]<\/p>","protected":false},"author":55,"featured_media":7450,"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":[2378,2306,1261,1725,2304],"ppma_author":[8929],"class_list":["post-6029","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-couchbase-server","category-performance","category-n1ql-query","tag-6-5","tag-analytical-functions","tag-json","tag-nosql-database","tag-reporting"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>On Par with Window Functions. - The Couchbase Blog<\/title>\n<meta name=\"description\" content=\"This post focuses on Window Functions and it&#039;s purpose. How to write a query without using windows functions and with Window functions in Mad-Hatter.\" \/>\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\/on-par-with-window-functions-in-n1ql\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"On Par with Window Functions.\" \/>\n<meta property=\"og:description\" content=\"This post focuses on Window Functions and it&#039;s purpose. How to write a query without using windows functions and with Window functions in Mad-Hatter.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/on-par-with-window-functions-in-n1ql\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-23T05:12:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:19:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1400\" \/>\n\t<meta property=\"og:image:height\" content=\"553\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Keshav Murthy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rkeshavmurthy\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Keshav Murthy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/\"},\"author\":{\"name\":\"Keshav Murthy\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c261644262bf98e146372fe647682636\"},\"headline\":\"On Par with Window Functions.\",\"datePublished\":\"2018-11-23T05:12:20+00:00\",\"dateModified\":\"2025-06-14T03:19:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/\"},\"wordCount\":515,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg\",\"keywords\":[\"6.5\",\"analytical functions\",\"JSON\",\"NoSQL Database\",\"reporting\"],\"articleSection\":[\"Application Design\",\"Couchbase Server\",\"High Performance\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/\",\"name\":\"On Par with Window Functions. - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg\",\"datePublished\":\"2018-11-23T05:12:20+00:00\",\"dateModified\":\"2025-06-14T03:19:54+00:00\",\"description\":\"This post focuses on Window Functions and it's purpose. How to write a query without using windows functions and with Window functions in Mad-Hatter.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg\",\"width\":1400,\"height\":553,\"caption\":\"Jespsen Code Image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"On Par with Window Functions.\"}]},{\"@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\/c261644262bf98e146372fe647682636\",\"name\":\"Keshav Murthy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4e51d72fc07c662aa791316deafffac4\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g\",\"caption\":\"Keshav Murthy\"},\"description\":\"Keshav Murthy is a Vice President at Couchbase R&amp;D. Previously, he was at MapR, IBM, Informix, Sybase, with more than 20 years of experience in database design &amp; development. He lead the SQL and NoSQL R&amp;D team at IBM Informix. He has received two President's Club awards at Couchbase, two Outstanding Technical Achievement Awards at IBM. Keshav has a bachelor's degree in Computer Science and Engineering from the University of Mysore, India, holds eleven US patents and has four US patents pending.\",\"sameAs\":[\"https:\/\/blog.planetnosql.com\/\",\"https:\/\/x.com\/rkeshavmurthy\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/keshav-murthy\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"On Par with Window Functions. - The Couchbase Blog","description":"This post focuses on Window Functions and it's purpose. How to write a query without using windows functions and with Window functions in Mad-Hatter.","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\/on-par-with-window-functions-in-n1ql\/","og_locale":"es_MX","og_type":"article","og_title":"On Par with Window Functions.","og_description":"This post focuses on Window Functions and it's purpose. How to write a query without using windows functions and with Window functions in Mad-Hatter.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/on-par-with-window-functions-in-n1ql\/","og_site_name":"The Couchbase Blog","article_published_time":"2018-11-23T05:12:20+00:00","article_modified_time":"2025-06-14T03:19:54+00:00","og_image":[{"width":1400,"height":553,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg","type":"image\/jpeg"}],"author":"Keshav Murthy","twitter_card":"summary_large_image","twitter_creator":"@rkeshavmurthy","twitter_misc":{"Written by":"Keshav Murthy","Est. reading time":"4 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/"},"author":{"name":"Keshav Murthy","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c261644262bf98e146372fe647682636"},"headline":"On Par with Window Functions.","datePublished":"2018-11-23T05:12:20+00:00","dateModified":"2025-06-14T03:19:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/"},"wordCount":515,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg","keywords":["6.5","analytical functions","JSON","NoSQL Database","reporting"],"articleSection":["Application Design","Couchbase Server","High Performance","SQL++ \/ N1QL Query"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/","url":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/","name":"On Par with Window Functions. - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg","datePublished":"2018-11-23T05:12:20+00:00","dateModified":"2025-06-14T03:19:54+00:00","description":"This post focuses on Window Functions and it's purpose. How to write a query without using windows functions and with Window functions in Mad-Hatter.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/08\/Transactions-alternative-2.jpg","width":1400,"height":553,"caption":"Jespsen Code Image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/on-par-with-window-functions-in-n1ql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"On Par with Window Functions."}]},{"@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\/c261644262bf98e146372fe647682636","name":"Keshav Murthy","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/4e51d72fc07c662aa791316deafffac4","url":"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g","caption":"Keshav Murthy"},"description":"Keshav Murthy es Vicepresidente de Couchbase R&amp;D. Anteriormente, estuvo en MapR, IBM, Informix, Sybase, con m\u00e1s de 20 a\u00f1os de experiencia en dise\u00f1o y desarrollo de bases de datos. Dirigi\u00f3 el equipo de I+D de SQL y NoSQL en IBM Informix. Ha recibido dos premios President's Club en Couchbase y dos premios Outstanding Technical Achievement en IBM. Keshav es licenciado en Inform\u00e1tica e Ingenier\u00eda por la Universidad de Mysore (India), es titular de once patentes estadounidenses y tiene cuatro pendientes.","sameAs":["https:\/\/blog.planetnosql.com\/","https:\/\/x.com\/rkeshavmurthy"],"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/keshav-murthy\/"}]}},"authors":[{"term_id":8929,"user_id":55,"is_guest":0,"slug":"keshav-murthy","display_name":"Keshav Murthy","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/af74df754db27152971d0aed2f323ead5a1f9fe5afd0209af91e12e784451224?s=96&d=mm&r=g","first_name":"Keshav","last_name":"Murthy","user_url":"https:\/\/blog.planetnosql.com\/","author_category":"","description":"Keshav Murthy es Vicepresidente de Couchbase R&amp;D. Anteriormente, estuvo en MapR, IBM, Informix, Sybase, con m\u00e1s de 20 a\u00f1os de experiencia en dise\u00f1o y desarrollo de bases de datos. Dirigi\u00f3 el equipo de I+D de SQL y NoSQL en IBM Informix. Ha recibido dos premios President's Club en Couchbase y dos premios Outstanding Technical Achievement en IBM. Keshav es licenciado en Inform\u00e1tica e Ingenier\u00eda por la Universidad de Mysore (India), es titular de diez patentes estadounidenses y tiene tres pendientes."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/6029","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\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=6029"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/6029\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/7450"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=6029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=6029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=6029"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=6029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}