{"id":6322,"date":"2019-01-24T12:04:52","date_gmt":"2019-01-24T20:04:52","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=6322"},"modified":"2025-06-13T20:19:53","modified_gmt":"2025-06-14T03:19:53","slug":"n1ql-to-query-or-to-analyze","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/","title":{"rendered":"N1QL: To Query or To Analyze?"},"content":{"rendered":"<p>Note: This recommendation note was written in collaboration with Till Westmann and Mike Carey, who lead the Couchbase analytics R&amp;D.<\/p>\n<p>[Part 2 of this article by Even Pease is at: <a href=\"https:\/\/www.couchbase.com\/blog\/part-2-n1ql-to-query-or-to-analyze\/\">https:\/\/www.couchbase.com\/blog\/part-2-n1ql-to-query-or-to-analyze\/<\/a>]<\/p>\n<p><span style=\"font-weight: 400\">Couchbase&#8217;s Query and Analytics Services both support N1QL (SQL for JSON). \u00a0A common question is: \u201cWhich service should run my query?\u201d.\u00a0<\/span><span style=\"font-weight: 400\">The quick answer is: \u201cIt depends on your <a href=\"https:\/\/www.couchbase.com\/blog\/its-the-workload-stupid\/\">workload<\/a>\u201d. \u00a0This blog explains this answer.<\/span><\/p>\n<p><span style=\"font-weight: 400\">A transaction is when you buy coffee and cake at the grocery store.\u00a0<\/span><span style=\"font-weight: 400\">The analysis is when the grocery store looks at all the sales data to see what day of the week, what month of the year coffee and\/or cake sells more &#8211; so they can plan the inventory, sales, and prices.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Every business does these three things in a cycle or a spiral [The Goal]. <\/span><\/p>\n<ol>\n<li><span style=\"font-weight: 400\">Run the business process to deliver products or services to the customers.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Analyze the business to determine what to change and what to change to.<\/span><\/li>\n<li><span style=\"font-weight: 400\">Make the change happen.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400\">In modern day business, each step requires applications perform the steps.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6323 aligncenter\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-18-at-4.10.08-PM-300x151.png\" alt=\"\" width=\"657\" height=\"330\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/01\/Screen-Shot-2019-01-18-at-4.10.08-PM-300x151.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/01\/Screen-Shot-2019-01-18-at-4.10.08-PM-1024x516.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/01\/Screen-Shot-2019-01-18-at-4.10.08-PM-768x387.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/01\/Screen-Shot-2019-01-18-at-4.10.08-PM-20x10.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/01\/Screen-Shot-2019-01-18-at-4.10.08-PM.png 1044w\" sizes=\"auto, (max-width: 657px) 100vw, 657px\" \/><\/p>\n<p><span style=\"font-weight: 400\">The Query Service is used by the applications needed to run the the business; it is designed for large number of concurrent queries, each doing small amount of work. \u00a0In the RDBMS world, this workload is called the OLTP workload. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Applications or tools used for analysis have different workload characteristics. \u00a0These typically use the Analytics Service; it is designed for a smaller number of concurrent queries analyzing a larger number of documents. In the RDBMS world, this workload is called the OLAP workload. \u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Let\u2019s drill down into details into these two services.<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center\"><span style=\"color: #ff0000\"><b>Query Service<\/b><\/span><\/td>\n<td style=\"text-align: center\"><span style=\"color: #ff0000\"><b>Analytics Service<\/b><\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>Tutorials<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/query-tutorial.couchbase.com\/tutorial\/#1\"><span style=\"font-weight: 400\">https:\/\/query-tutorial.couchbase.com\/tutorial\/#1<\/span><\/a><\/td>\n<td><a href=\"https:\/\/sqlplusplus-tutorial.couchbase.com\/tutorial\/#1\"><span style=\"font-weight: 400\">https:\/\/sqlplusplus-tutorial.couchbase.com\/tutorial\/#1<\/span><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>High Level Comparison<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Used for data manipulation within application logic<\/span><\/td>\n<td><span style=\"font-weight: 400\">Used for reports, analysis (historical, interactive), dashboards<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Short queries<\/span><\/p>\n<p><span style=\"font-weight: 400\"> \u00a0&#8212; Relatively simple SQL<\/span><\/p>\n<p><span style=\"font-weight: 400\"> \u00a0&#8212; Typically involving small amounts of data<\/span><\/td>\n<td><span style=\"font-weight: 400\">Longer operations<\/span><\/p>\n<p><span style=\"font-weight: 400\"> \u00a0&#8212; Complex SQL with analytics<\/span><\/p>\n<p><span style=\"font-weight: 400\"> \u00a0&#8212; Typically involving larger amounts of data<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Run SELECT, INSERT, UPDATE, DELETE, MERGE for operational applications<\/span><\/td>\n<td><span style=\"font-weight: 400\">Run SELECT for analysis<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Random Updates<\/span><\/p>\n<p><span style=\"font-weight: 400\"> \u00a0&#8212; Update few documents per query<\/span><\/td>\n<td><span style=\"font-weight: 400\">No Updates<\/span><\/p>\n<p><span style=\"font-weight: 400\"> \u00a0&#8212; Changes ingested from Data Service<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Millisecond to a second latency,<\/span><\/p>\n<p><span style=\"font-weight: 400\">high throughput (10-1000 qps), performance goal is queries\/second<\/span><\/td>\n<td><span style=\"font-weight: 400\">Second to minutes response time,<\/span><\/p>\n<p><span style=\"font-weight: 400\">&lt;1-10 queries per second,<\/span><\/p>\n<p><span style=\"font-weight: 400\">performance goal is seconds\/query<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Large number of Indexes<\/span><\/td>\n<td><span style=\"font-weight: 400\">Fewer indexes<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Developer written queries; generated queries are well known<\/span><\/td>\n<td><span style=\"font-weight: 400\">Ad-hoc queries; complex reports, dashboards, BI workload<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Queries execute on a single query node using the distributed index and data infrastructure<\/span><\/td>\n<td><span style=\"font-weight: 400\">Queries execute on all analytics nodes using its distributed compute, index and data infrastructure<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>Technical Comparison: Architecture<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Queries run in SMP mode, throughput is scalable by adding new query nodes<\/span><\/td>\n<td><span style=\"font-weight: 400\">Queries run in MPP mode, can handle larger data or reduce query execution times by adding new analytics nodes<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>Technical Comparison: Optimizer<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Nested loop join by default<\/span><\/p>\n<p><span style=\"font-weight: 400\">Hash join via query hint<\/span><\/td>\n<td><span style=\"font-weight: 400\">Parallel hash join by default,<\/span><\/p>\n<p><span style=\"font-weight: 400\">(Index-)Nested loop join or broadcast join via query hint<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>Technical Comparison: Indexes<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Global secondary indexes<\/span><\/td>\n<td><span style=\"font-weight: 400\">Local secondary indexes (co-located with data partitions)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Uses Memory Optimized Indexes; standard secondary indexes (Plasma)<\/span><\/td>\n<td><span style=\"font-weight: 400\">Log-structured Merge Tree (LSM) based secondary indexes<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Support for both covered and non-covered index scans<\/span><\/td>\n<td><span style=\"font-weight: 400\">Non-covered index scans<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Can use full text index for queries (6.5)<\/span><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>Technical Comparison: Execution<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Most queries are prepared once and executed many times<\/span><\/td>\n<td><span style=\"font-weight: 400\">Ad-hoc and exploratory queries<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">SDKs use the prepare-execute model based on a ad-hoc flag<\/span><\/td>\n<td><span style=\"font-weight: 400\">SDKs offer ad-hoc and parameterized queries<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Most operations are done in memory; only when an index scan returns large data is it written to the disk backfill<\/span><\/td>\n<td><span style=\"font-weight: 400\">Bounded-memory operations on large data (larger than cluster memory) with graceful spilling as needed<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Single node query parallelism<\/span><\/td>\n<td><span style=\"font-weight: 400\">Multi-node partitioned-parallel join, sort, aggregate, and grouped aggregate operators<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Expects a single (possibly RAIDed) storage device<\/span><\/td>\n<td><span style=\"font-weight: 400\">Un-RAIDed use of multiple storage devices<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">Performance isolation via covering indexes that support scan, grouping, and aggregation operations on Index Service nodes<\/span><\/td>\n<td><span style=\"font-weight: 400\">Performance isolation for all queries via shadowing of data on Analytics Service nodes<\/span><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><strong><span style=\"color: #0000ff\">Technical Documentation<\/span><\/strong><\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.couchbase.com\/server\/6.0\/n1ql\/n1ql-language-reference\/index.html\"><span style=\"font-weight: 400\">https:\/\/docs.couchbase.com\/server\/6.0\/n1ql\/n1ql-language-reference\/index.html<\/span><\/a><\/td>\n<td><a href=\"https:\/\/docs.couchbase.com\/server\/6.0\/analytics\/introduction.html\"><span style=\"font-weight: 400\">https:\/\/docs.couchbase.com\/server\/6.0\/analytics\/introduction.html<\/span><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>Technical Information<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.couchbase.com\/products\/n1ql\/\"><span style=\"font-weight: 400\">https:\/\/www.couchbase.com\/products\/n1ql<\/span><\/a><\/td>\n<td><a href=\"https:\/\/www.couchbase.com\/sqlplusplus\/\"><span style=\"font-weight: 400\">https:\/\/www.couchbase.com\/sqlplusplus<\/span><\/a><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center\" colspan=\"2\"><span style=\"color: #0000ff\"><strong>Technical Books<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/www.couchbase.com\/blog\/a-guide-to-n1ql-features-in-couchbase-5-5-special-edition\/\"><span style=\"font-weight: 400\">https:\/\/www.couchbase.com\/blog\/a-guide-to-n1ql-features-in-couchbase-5-5-special-edition\/<\/span><\/a><\/td>\n<td><a href=\"https:\/\/resources.couchbase.com\/sql_tutorial\"><span style=\"font-weight: 400\">https:\/\/resources.couchbase.com\/sql_tutorial<\/span><\/a><\/p>\n<p><a href=\"https:\/\/www.amazon.com\/SQL-Users-Tutorial-Don-Chamberlin\/dp\/0692184503\/\"><span style=\"font-weight: 400\">https:\/\/www.amazon.com\/SQL-Users-Tutorial-Don-Chamberlin\/dp\/0692184503\/<\/span><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">[The GOAL]: The Goal: The process of ongoing improvement.\u00a0<\/span><a href=\"https:\/\/www.amazon.com\/Goal-Process-Ongoing-Improvement\/dp\/0884271951\/ref=sr_1_1?keywords=the+goal&amp;qid=1547969233&amp;sr=8-1\">https:\/\/www.amazon.com\/Goal-Process-Ongoing-Improvement\/dp\/0884271951\/ref=sr_1_1?keywords=the+goal&amp;qid=1547969233&amp;sr=8-1<\/a><\/li>\n<li style=\"font-weight: 400\">Systems of Engagement for Customer Jobs: <a href=\"https:\/\/marketing.cioreview.com\/cxoinsight\/systems-of-engagement-for-customer-jobs-nid-24677-cid-51.html\">https:\/\/marketing.cioreview.com\/cxoinsight\/systems-of-engagement-for-customer-jobs-nid-24677-cid-51.html<\/a><\/li>\n<li>Part 2 of this article by Even Pease: <a href=\"https:\/\/www.couchbase.com\/blog\/part-2-n1ql-to-query-or-to-analyze\/\">https:\/\/www.couchbase.com\/blog\/part-2-n1ql-to-query-or-to-analyze\/<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Note: This recommendation note was written in collaboration with Till Westmann and Mike Carey, who lead the Couchbase analytics R&amp;D. [Part 2 of this article by Even Pease is at: https:\/\/www.couchbase.com\/blog\/part-2-n1ql-to-query-or-to-analyze\/] Couchbase&#8217;s Query and Analytics Services both support N1QL (SQL [&hellip;]<\/p>\n","protected":false},"author":55,"featured_media":5959,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1815,2294,1816,9417,1812],"tags":[1261,1725,2297],"ppma_author":[8929],"class_list":["post-6322","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-best-practices-and-tutorials","category-analytics","category-couchbase-server","category-performance","category-n1ql-query","tag-json","tag-nosql-database","tag-workload"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>N1QL: To Query or To Analyze? - 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-to-query-or-to-analyze\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"N1QL: To Query or To Analyze?\" \/>\n<meta property=\"og:description\" content=\"Note: This recommendation note was written in collaboration with Till Westmann and Mike Carey, who lead the Couchbase analytics R&amp;D. [Part 2 of this article by Even Pease is at: https:\/\/www.couchbase.com\/blog\/part-2-n1ql-to-query-or-to-analyze\/] Couchbase&#8217;s Query and Analytics Services both support N1QL (SQL [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-24T20:04:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T03:19:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1212\" \/>\n\t<meta property=\"og:image:height\" content=\"748\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\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 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-to-query-or-to-analyze\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/\"},\"author\":{\"name\":\"Keshav Murthy\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c261644262bf98e146372fe647682636\"},\"headline\":\"N1QL: To Query or To Analyze?\",\"datePublished\":\"2019-01-24T20:04:52+00:00\",\"dateModified\":\"2025-06-14T03:19:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/\"},\"wordCount\":794,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png\",\"keywords\":[\"JSON\",\"NoSQL Database\",\"workload\"],\"articleSection\":[\"Best Practices and Tutorials\",\"Couchbase Analytics\",\"Couchbase Server\",\"High Performance\",\"SQL++ \/ N1QL Query\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/\",\"name\":\"N1QL: To Query or To Analyze? - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png\",\"datePublished\":\"2019-01-24T20:04:52+00:00\",\"dateModified\":\"2025-06-14T03:19:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png\",\"width\":1212,\"height\":748},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"N1QL: To Query or To Analyze?\"}]},{\"@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\/c261644262bf98e146372fe647682636\",\"name\":\"Keshav Murthy\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@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\/author\/keshav-murthy\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"N1QL: To Query or To Analyze? - 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-to-query-or-to-analyze\/","og_locale":"en_US","og_type":"article","og_title":"N1QL: To Query or To Analyze?","og_description":"Note: This recommendation note was written in collaboration with Till Westmann and Mike Carey, who lead the Couchbase analytics R&amp;D. [Part 2 of this article by Even Pease is at: https:\/\/www.couchbase.com\/blog\/part-2-n1ql-to-query-or-to-analyze\/] Couchbase&#8217;s Query and Analytics Services both support N1QL (SQL [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/","og_site_name":"The Couchbase Blog","article_published_time":"2019-01-24T20:04:52+00:00","article_modified_time":"2025-06-14T03:19:53+00:00","og_image":[{"width":1212,"height":748,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png","type":"image\/png"}],"author":"Keshav Murthy","twitter_card":"summary_large_image","twitter_creator":"@rkeshavmurthy","twitter_misc":{"Written by":"Keshav Murthy","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/"},"author":{"name":"Keshav Murthy","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/c261644262bf98e146372fe647682636"},"headline":"N1QL: To Query or To Analyze?","datePublished":"2019-01-24T20:04:52+00:00","dateModified":"2025-06-14T03:19:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/"},"wordCount":794,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png","keywords":["JSON","NoSQL Database","workload"],"articleSection":["Best Practices and Tutorials","Couchbase Analytics","Couchbase Server","High Performance","SQL++ \/ N1QL Query"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/","url":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/","name":"N1QL: To Query or To Analyze? - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png","datePublished":"2019-01-24T20:04:52+00:00","dateModified":"2025-06-14T03:19:53+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2018\/11\/Screen-Shot-2018-11-14-at-3.46.47-PM.png","width":1212,"height":748},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/n1ql-to-query-or-to-analyze\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"N1QL: To Query or To Analyze?"}]},{"@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\/c261644262bf98e146372fe647682636","name":"Keshav Murthy","image":{"@type":"ImageObject","inLanguage":"en-US","@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\/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","author_category":"","last_name":"Murthy","first_name":"Keshav","job_title":"","user_url":"https:\/\/blog.planetnosql.com\/","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 ten US patents and has three US patents pending."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/6322","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\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=6322"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/6322\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/5959"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=6322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=6322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=6322"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=6322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}