{"id":2101,"date":"2016-01-05T18:03:32","date_gmt":"2016-01-05T18:03:32","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2101"},"modified":"2025-06-13T19:30:33","modified_gmt":"2025-06-14T02:30:33","slug":"n1ql-vs-tsql-processing-aggregations","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/","title":{"rendered":"N1QL vs TSQL &#8211; Aggregations with Couchbase Server vs SQL Server"},"content":{"rendered":"<p>SQL has been around for a loooooong time. It is very intuitive and efficient way to process structured data and has been the choice for databases for many years. With the world of BIG DATA however, data has <em>velocity<\/em>, <em>variety <\/em>and <em>volume<\/em>. SQL can tackle the 2 \u201c<em>v<\/em>\u201ds fine with optimizations: \u201c<em>velocity<\/em>\u201d and \u201c<em>volume<\/em>\u201d. In fact, many new dielects of SQL (N1QL, Spark, U-SQL, Impala, Drill and more) are doing exactly that. However, \u201c<em>variety<\/em>\u201d is a different ballgame! Big Data is complex in the new world; it has unpredictable, constantly evolving, jagged scheme, sparse values and deeply nested structures. For that SQL needs to be extended!<\/p>\n<p>Well, I am super excited to report that we have built N1QL in Couchbase Server 4\u00a0to tackle exactly these issues! N1QL can easily traverse over the complex structures\u00a0in JSON (the de-facto serialization standard for complex data). Using N1QL, you can work with not only NULLs but attributes that are <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/4.1\/n1ql\/n1ql-language-reference\/literals.html\">MISSING<\/a> in various\u00a0shapes of\u00a0JSON you process.\u00a0OR you can use operators like <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/4.1\/n1ql\/n1ql-language-reference\/collectionops.html\">ANY\/EVERY<\/a> to query over arrays embedded within JSON document. OR you can use commands like <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/4.1\/n1ql\/n1ql-language-reference\/from.html\">UNNEST &amp; NEST<\/a> that can flatten or unflatten nested arrays. There are too many of these powerful extensions to count here so I won&#8217;t do that. Instead I am going to show you one hidden gem that was originally posted <a href=\"https:\/\/stackoverflow.com\/questions\/34117559\/obtaining-last-revisions-in-couchbase-with-n1ql\/34122200#34122200\">here<\/a> by Gerald.\u00a0This gem\u00a0is very useful with aggregates if you are using N1QL. vs a relational database like SQL Server.<\/p>\n<p>One of the big advantages of N1QL is its ability to understand the array types. Aggregation functions like MAX() are not revolutionary but with the additions of nesting and arrays, something as simple as MAX() can be super powerful. One note before I dive in &#8211; I am going to pick on TSQL and SQL Server as I contributed to TSQL in past life at Microsoft. However this is as applicable to Oracle, Postgres, Mysql, Informix or DB2 and more&#8230; Ok so: Imagine trying to find attributes of the product that has the MAX price. In SQL Server that is fairly simple query to write using TSQL;<\/p>\n<pre><code class=\"language-sql\">SELECT productID, name FROM t1\r\nWHERE price = (SELECT MAX(price) FROM t1)\r\nGO<\/code><\/pre>\n<p>That is good. Here is the output &#8211; the product with the highest price is product named &#8220;c&#8221; with ID 3.<\/p>\n<pre><code class=\"language-bash\">productID            name\r\n-----------          -----------------------------------------------------------------\r\n3                    c\r\n<\/code><\/pre>\n<p>Here is the execution plan looks like. Basically \u00a0The execution plan scans for the MAX price value. Once you have the value, It is a nested loop join to search for the other attributes of the product in the table like productID and name.<\/p>\n<pre><code class=\"language-bash\">Stmt Text\r\n---------------------------------------------------------------------------------------------\r\nselect productID, name from t1 where price = (select max(price) from t1)\r\n  |--Nested Loops(Inner Join, WHERE:([Expr1004]=[test].[dbo].[t1].[price]))\r\n       |--Stream Aggregate(DEFINE:([Expr1004]=MAX([test].[dbo].[t1].[price])))\r\n       |    |--Clustered Index Scan(OBJECT:([test].[dbo].[t1].[PK__t1__2D10D14A7FD17868]))\r\n       |--Clustered Index Scan(OBJECT:([test].[dbo].[t1].[PK__t1__2D10D14A7FD17868]))\r\n<\/code><\/pre>\n<p>However, N1QL has a great\u00a0advantage here. Since it can process MAX() with arrays, you can return all the attributes of the document\u00a0without an additional scan.<\/p>\n<pre><code class=\"language-sql\">SELECT MAX([price, {productID, name]) FROM test;<\/code><\/pre>\n<p>OR you can simply return the full document using the following query;<\/p>\n<pre><code class=\"language-sql\">SELECT MAX([price, test]) FROM test;<\/code><\/pre>\n<p>Lets take a look at the execution plan for the N1QL query. Here comes the spoiler: you see a single FETCH operation that can perform the MAX and the projection is done without a second FETCH.<\/p>\n<pre class=\"lang:default decode:true\">cbq&gt;explain select MAX([price,test])from test;\r\n{\r\n    \"requestID\":\"b735ce5f-700c-4740-a065-6d4ba681129f\",\r\n    \"signature\":\"json\",\r\n    \"results\":[\r\n        {\r\n            \"#operator\":\"Sequence\",\r\n            \"~children\":[\r\n                {\r\n                    \"#operator\":\"PrimaryScan\",\r\n                    \"index\":\"#primary\",\r\n                    \"keyspace\":\"test\",\r\n                    \"namespace\":\"default\",\r\n                    \"using\":\"gsi\"\r\n                },\r\n                {\r\n                    \"#operator\":\"Parallel\",\r\n                    \"~child\":{\r\n                        \"#operator\":\"Sequence\",\r\n                        \"~children\":[\r\n                            {\r\n                                \"#operator\":\"Fetch\",\r\n                                \"keyspace\":\"test\",\r\n                                \"namespace\":\"default\"\r\n                            },\r\n                            {\r\n                                \"#operator\":\"InitialGroup\",\r\n                                \"aggregates\":[\r\n                                    \"max([(`test`.`price`), `test`])\"\r\n                                ],\r\n                                \"group_keys\":[]\r\n                            }\r\n                        ]\r\n                    }\r\n                },\r\n                {\r\n                    \"#operator\":\"IntermediateGroup\",\r\n                    \"aggregates\":[\r\n                        \"max([(`test`.`price`), `test`])\"\r\n                    ],\r\n                    \"group_keys\":[]\r\n                },\r\n                {\r\n                    \"#operator\":\"FinalGroup\",\r\n                    \"aggregates\":[\r\n                        \"max([(`test`.`price`), `test`])\"\r\n                    ],\r\n                    \"group_keys\":[]\r\n                },\r\n                {\r\n                    \"#operator\":\"Parallel\",\r\n                    \"~child\":{\r\n                        \"#operator\":\"Sequence\",\r\n                        \"~children\":[\r\n                            {\r\n                                \"#operator\":\"InitialProject\",\r\n                                \"result_terms\":[\r\n                                    {\r\n                                        \"expr\":\"max([(`test`.`price`), `test`])\"\r\n                                    }\r\n                                ]\r\n                            },\r\n                            {\r\n                                \"#operator\":\"FinalProject\"\r\n                            }\r\n                        ]\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n    ],\r\n    \"status\":\"success\",\r\n    \"metrics\":{\r\n        \"elapsedTime\":\"1.8224ms\",\r\n        \"executionTime\":\"1.7614ms\",\r\n        \"resultCount\":1,\r\n        \"resultSize\":2347\r\n    }\r\n}<\/pre>\n<p>Even though, this is a pretty cool trick and a great performance gain, We just scratched the surface of what N1QL is capable of. There is a ton more to discover with N1QL. You can get started with Couchbase Server and N1QL here with the <a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/4.1\/getting-started\/index.html\">getting started guide<\/a>.<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>By the way if you&#8217;d like to try this out with SQL Server 2016 and Couchbase 4, here are the scripts\u00a0to see this yourself in action;<\/p>\n<p>SQL Server Script<\/p>\n<p>Note: Run this in a database called &#8220;test&#8221;<\/p>\n<pre class=\"lang:default decode:true\">create table t1(productID int primary key, price int, name varchar(128));\r\ngo\r\ninsert into t1(productID,price,name) values(1,10,'a');\r\ninsert into t1(productID,price,name) values(2,9,'b');\r\ninsert into t1(productID,price,name) values(3,12,'c');\r\ninsert into t1(productID,price,name) values(4,11,'d');\r\ninsert into t1(productID,price,name) values(5,1,'e');\r\ngo\r\nset statistics profile on\r\ngo\r\nselect max(price),productID,name from t1\r\ngo\r\n--Msg 8120, Level 16, State 1, Line 10\r\n--Column 't1.productID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.\r\nselect productID, name from t1 where price = (select max(price) from t1)\r\ngo<\/pre>\n<p>Here is the Couchbase Server Script<\/p>\n<p>Note: create a bucket called &#8220;test&#8221;<\/p>\n<p>insert into test(key,value) values(&#8220;1&#8221;,{productID:1, price:10, name:&#8217;a&#8217;});<\/p>\n<div>\n<pre class=\"lang:default decode:true\">insert into test(key,value) values(\"1\",{productID:1, price:10, name:'a'}); \r\ninsert into test(key,value) values(\"2\",{\"productID\":2, \"price\":9, \"name\":\"b\"});\r\ninsert into test(key,value) values(\"3\",{\"productID\":3, \"price\":12, \"name\":\"c\"});\r\ninsert into test(key,value) values(\"4\",{\"productID\":4, \"price\":11, \"name\":\"d\"});\r\ninsert into test(key,value) values(\"5\",{\"productID\":5, \"price\":1, \"name\":\"e\"});\r\ncreate primary index on test;\r\nselect max(price, productID, name) from t1;\r\nselect max([price, test]) from test;\r\nexplain select max([price, test]) from test;<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>SQL has been around for a loooooong time. It is very intuitive and efficient way to process structured data and has been the choice for databases for many years. With the world of BIG DATA however, data has velocity, variety [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1816,1812],"tags":[1556],"ppma_author":[8978],"class_list":["post-2101","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-server","category-n1ql-query","tag-sql-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>N1QL vs TSQL - Aggregations with Couchbase Server vs SQL Server - 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\/n1ql-vs-tsql-processing-aggregations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"N1QL vs TSQL - Aggregations with Couchbase Server vs SQL Server\" \/>\n<meta property=\"og:description\" content=\"SQL has been around for a loooooong time. It is very intuitive and efficient way to process structured data and has been the choice for databases for many years. With the world of BIG DATA however, data has velocity, variety [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-01-05T18:03:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T02:30:33+00:00\" \/>\n<meta name=\"author\" content=\"Cihan Biyikoglu, Director of Product Management, 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=\"Cihan Biyikoglu, Director of Product Management, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/\"},\"author\":{\"name\":\"Cihan Biyikoglu, Director of Product Management, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3d8c60500ca29254fcdb2f76f29fb088\"},\"headline\":\"N1QL vs TSQL &#8211; Aggregations with Couchbase Server vs SQL Server\",\"datePublished\":\"2016-01-05T18:03:32+00:00\",\"dateModified\":\"2025-06-14T02:30:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/\"},\"wordCount\":626,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"keywords\":[\"SQL Server\"],\"articleSection\":[\"Couchbase Server\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/\",\"name\":\"N1QL vs TSQL - Aggregations with Couchbase Server vs SQL Server - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2016-01-05T18:03:32+00:00\",\"dateModified\":\"2025-06-14T02:30:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#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\/n1ql-vs-tsql-processing-aggregations\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"N1QL vs TSQL &#8211; Aggregations with Couchbase Server vs SQL Server\"}]},{\"@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\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@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\/3d8c60500ca29254fcdb2f76f29fb088\",\"name\":\"Cihan Biyikoglu, Director of Product Management, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/a878e65cb37ac2419416d3289816abd5\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3e1ac58dd480dd8a6e93d700a58d329bb81df928061de04395055a45274b8702?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3e1ac58dd480dd8a6e93d700a58d329bb81df928061de04395055a45274b8702?s=96&d=mm&r=g\",\"caption\":\"Cihan Biyikoglu, Director of Product Management, Couchbase\"},\"description\":\"Cihan Biyikoglu is a director of product management at Couchbase, responsible for the Couchbase Server product. Cihan is a big data enthusiast who brings over twenty years of experience to Redis Labs\u2019 product team. Cihan started his career as a C\/C++ developer.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/cihan-biyikoglu\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"N1QL vs TSQL - Aggregations with Couchbase Server vs SQL Server - 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\/n1ql-vs-tsql-processing-aggregations\/","og_locale":"en_US","og_type":"article","og_title":"N1QL vs TSQL - Aggregations with Couchbase Server vs SQL Server","og_description":"SQL has been around for a loooooong time. It is very intuitive and efficient way to process structured data and has been the choice for databases for many years. With the world of BIG DATA however, data has velocity, variety [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/","og_site_name":"The Couchbase Blog","article_published_time":"2016-01-05T18:03:32+00:00","article_modified_time":"2025-06-14T02:30:33+00:00","author":"Cihan Biyikoglu, Director of Product Management, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Cihan Biyikoglu, Director of Product Management, Couchbase","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/"},"author":{"name":"Cihan Biyikoglu, Director of Product Management, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/3d8c60500ca29254fcdb2f76f29fb088"},"headline":"N1QL vs TSQL &#8211; Aggregations with Couchbase Server vs SQL Server","datePublished":"2016-01-05T18:03:32+00:00","dateModified":"2025-06-14T02:30:33+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/"},"wordCount":626,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","keywords":["SQL Server"],"articleSection":["Couchbase Server","SQL++ \/ N1QL Query"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/","url":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/","name":"N1QL vs TSQL - Aggregations with Couchbase Server vs SQL Server - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2016-01-05T18:03:32+00:00","dateModified":"2025-06-14T02:30:33+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-vs-tsql-processing-aggregations\/#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\/n1ql-vs-tsql-processing-aggregations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"N1QL vs TSQL &#8211; Aggregations with Couchbase Server vs SQL Server"}]},{"@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":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@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\/3d8c60500ca29254fcdb2f76f29fb088","name":"Cihan Biyikoglu, Director of Product Management, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/a878e65cb37ac2419416d3289816abd5","url":"https:\/\/secure.gravatar.com\/avatar\/3e1ac58dd480dd8a6e93d700a58d329bb81df928061de04395055a45274b8702?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3e1ac58dd480dd8a6e93d700a58d329bb81df928061de04395055a45274b8702?s=96&d=mm&r=g","caption":"Cihan Biyikoglu, Director of Product Management, Couchbase"},"description":"Cihan Biyikoglu is a director of product management at Couchbase, responsible for the Couchbase Server product. Cihan is a big data enthusiast who brings over twenty years of experience to Redis Labs\u2019 product team. Cihan started his career as a C\/C++ developer.","url":"https:\/\/www.couchbase.com\/blog\/author\/cihan-biyikoglu\/"}]}},"authors":[{"term_id":8978,"user_id":7,"is_guest":0,"slug":"cihan-biyikoglu","display_name":"Cihan Biyikoglu, Director of Product Management, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/3e1ac58dd480dd8a6e93d700a58d329bb81df928061de04395055a45274b8702?s=96&d=mm&r=g","author_category":"","last_name":"Biyikoglu","first_name":"Cihan","job_title":"","user_url":"","description":"Cihan Biyikoglu is a director of product management at Couchbase, responsible for the Couchbase Server product. Cihan is a big data enthusiast who brings over twenty years of experience to Redis Labs\u2019 product team. Cihan started his career as a C\/C++ developer."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=2101"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2101\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=2101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2101"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}