{"id":39,"date":"2014-12-16T19:21:01","date_gmt":"2014-12-16T19:21:01","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/caching-queries-couchbase-high-performance\/"},"modified":"2014-12-16T19:21:01","modified_gmt":"2014-12-16T19:21:01","slug":"caching-queries-couchbase-high-performance","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/","title":{"rendered":"Caching queries in Couchbase for high performance"},"content":{"rendered":"<p><span>Starting from version 2.0, Couchbase server offers a powerful way of creating indexes for JSON documents through the concept of views.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Using views, it is possible to define primary indexes, composite indexes and aggregations allowing to:<\/span><\/p>\n\n\n\n<p><span>. query documents on different JSON properties<\/span><\/p>\n\n\n\n<p><span>. create statistics and aggregates<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Views generate materialized indexes so provide a fast and efficient way for executing pre-defined queries.<\/span><\/p>\n\n\n\n<p><span>However in Couchbase 2.x, indexes are stored to disk and read from disk for each query, which has some performance implications.<\/span><\/p>\n\n\n\n<p><span>In the future Couchbase will allow caching indexes into the managed cache similar to what is done for JSON documents to speed up queries.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>In the meantime, this blog provides a simple example of how query results can be cached into Couchbase to be retrieved from the cache instead of being served from index on disk.<\/span><\/p>\n\n\n\n<p><span>This is useful for scenarios where a query for an index does not need to be up to date immediately (minutes or more are ok) but is read often (multiple times a second). In this case, the query results will be calculated only every so often based on application needs and read from managed cache the rest of time.<\/span><\/p>\n\n\n\n<p><span>A good use case example for this, is a game leaderboard. A view can be used to create an index for top scores for a particular game and that view can be queried every few mins (say 5 minutes) and cached into Couchbase Server. All requests for the view will go against the cached value and as such will only take ms and do not need any index querying on the server.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Note that, the method above is independent from automatic updating of indexes. By default, every index in Couchbase is updated every 5 seconds or 5000 updates, both tunable through the REST API. Learn more about that at: <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/es\/docs\/couchbase-manual-2.1.0\/couchbase-views-operation-autoupdate.html\/\"><span>https:\/\/www.couchbase.com\/docs\/couchbase-manual-2.1.0\/couchbase-views-operation-autoupdate.html<\/span><\/a><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>So this means that while the index can be kept up to date, specific queries, which do not need to be up to date, can be cached for higher throughput and lower latency. The only caveat is that maximum length for values in Couchbase is 20MB so cached queries should not be used for super large result sets although it always possible to split results into multiple cached values for larger sets.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>This is fairly simple to implement, let\u2019s take a look at how can we do this in Java.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>I will use the bee-sample database, which comes with Couchbase server. If you have not installed it already, go into Settings and select beer-sample then click on Create:<\/span><\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/_oXSD-xwVf19lCK_ay7AV4-7QA5xp8J0_gvleCdBxAnr7p83PWMWfTRPdhbaii6U8UxVaZAYtkb9g7wthcL0cKhRveyh7E3MzPqppp4dhqO8IBB0SyUzNgaZxbfft46jqw\" width=\"625px;\" height=\"252px;\"><\/p>\n\n\n\n<p><span>This comes with a brewery_beer view, which I will use to build the caching example:<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/3OHfnKG4zTrvhMOGOOnF3l-1a4SRO1nBnxi_34YsJRwTpY6S5CQUXYqhyMmcv_coNtxQKLcvJ0oG9FghAmIqtzQ4z8YD8jTwbuNn3d9rPIp1AAi2oWhHbRXgNnpkAfg4Rw\" width=\"667px;\" height=\"214px;\"><\/p>\n\n\n\n<p><span>Now let\u2019s take a look at a simple Java application that can be used to execute and cache a query and compare against executing the query every time.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>The Java code below, first connects to the bee-sample database and:<\/span><\/p>\n\n\n\n<p><span>. executes the query 1 time and reads it from the cache n times or<\/span><\/p>\n\n\n\n<p><span>. executes the query n times<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>In both cases, a timer is started before and after to measure the execution time.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>The code is very straightforward, uses no parameters for the query but use includeDocs to retrieve all JSON documents associated to the results of the query vs just the document IDs.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>To learn more about views and queries in Couchbase, read: <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/es\/docs\/couchbase-devguide-2.1.0\/indexing-querying-data.html\/\"><span>https:\/\/www.couchbase.com\/docs\/couchbase-devguide-2.1.0\/indexing-querying-data.html<\/span><\/a><\/p>\n\n\n\n<p><span>The full source code is:<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\/\/ @author Alexis Roos<\/span><\/p>\n\n\n\n<p><span>package com.couchbase.dev.examples;<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>import com.couchbase.client.CouchbaseClient;<\/span><\/p>\n\n\n\n<p><span>import com.couchbase.client.protocol.views.*;<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>import java.net.URI;<\/span><\/p>\n\n\n\n<p><span>import java.util.LinkedList;<\/span><\/p>\n\n\n\n<p><span>import java.util.List;<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>public class CachedQuery {<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0public static void main(String args[]) {<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0List uris = new LinkedList();<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0uris.add(URI.create(&#8220;https:\/\/127.0.0.1:8091\/pools&#8221;));<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0CouchbaseClient client = null;<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0try {<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0client = new CouchbaseClient(uris, &#8220;beer-sample&#8221;, &#8220;&#8221;);<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0int requestCount = 100;<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0double t1 = System.currentTimeMillis();<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0View view = client.getView(&#8220;beer&#8221;, &#8220;brewery_beers&#8221;);<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Query query = new Query();<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0query.setIncludeDocs(true).setLimit(10000);<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0query.setStale(Stale.FALSE);<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Doing query a single time and caching it<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ViewResponse result = client.query(view, query);<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0client.set(&#8220;cachedBrewery_beersQuery&#8221;, 0, result.toString());<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Using cache for subsequent requests<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (int i = 0; i &lt; requestCount &#8211; 1; i++) {<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0String cachedIndex = (String) client.get(&#8220;cachedBrewery_beersQuery&#8221;);<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0double t2 = System.currentTimeMillis();<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(&#8220;Test with cache finished in &#8221; + (t2 &#8211; t1) \/ 1000 + &#8221; seconds&#8221;);<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0t1 = System.currentTimeMillis();<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ Querying every single time<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (int i = 0; i &lt; requestCount; i++) {<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0result = client.query(view, query);<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0t2 = System.currentTimeMillis();<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(&#8220;Test without cache finished in &#8221; + (t2 &#8211; t1) \/ 1000 + &#8221; seconds&#8221;);<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0client.shutdown();<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0} catch (Exception e) {<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.err.println(&#8220;Error connecting to Couchbase: &#8221; + e.getMessage());<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.exit(0);<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<\/span><\/p>\n\n\n\n<p><span>\u00a0\u00a0\u00a0}<\/span><\/p>\n\n\n\n<p><span>}<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Running the code outputs both test results, which for 100 serial queries yields:<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Test with cache finished in 3.755 seconds<\/span><\/p>\n\n\n\n<p><span>Test without cache finished in 19.835 seconds<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Not only test with cache is a lot faster but it also requires fewer resources on the Couchbase server.<\/span><\/p>\n\n\n\n<p><span>The following graph shows the ops per second metric for the beer-sample bucket and the first small bump corresponds to test with cache (essentially mapping to the number of documents for breweries and beers as the query is ran only once), whereas the rest of the larger curve shows that the query has been executed many times and as such resulted in many more operations per second.<\/span><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/66yA3BecvZ73bSpADJg_WzAv_xC3vIj8_klqNk01zZyIZhcHZxfsdta7TX38i45JIwd026Ql-uypZOAa2eRRs5fazx4HrNnlN0n4pbWeCZnBs_VI3tSmPRiS7Bs9RyMpgQ\" width=\"623px;\" height=\"468px;\"><\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p><span>Using caching for querying views is easy and it is simple to set up a program, which will periodically query the view and store the result into Couchbase server where it will be cached. In turn applications can use this cached value for efficiency.<\/span><\/p>\n\n\n\n<p><span>This should be used as appropriate based on application use cases.<\/span><\/p>","protected":false},"excerpt":{"rendered":"<p>Starting from version 2.0, Couchbase server offers a powerful way of creating indexes for JSON documents through the concept of views. \u00a0 Using views, it is possible to define primary indexes, composite indexes and aggregations allowing to: . query documents on different JSON properties . create statistics and aggregates \u00a0 Views generate materialized indexes so [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":18,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[17,18],"tags":[19,20],"ppma_author":[21],"class_list":["post-39","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-performance","category-n1ql-query","tag-caching","tag-views"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Caching Queries Results for High Performance | Couchbase<\/title>\n<meta name=\"description\" content=\"This blog provides examples of how query results can be cached into Couchbase to be retrieved from the cache instead of being served from index on disk.\" \/>\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\/caching-queries-couchbase-high-performance\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Caching queries in Couchbase for high performance\" \/>\n<meta property=\"og:description\" content=\"This blog provides examples of how query results can be cached into Couchbase to be retrieved from the cache instead of being served from index on disk.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-16T19:21:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/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=\"Alexis Roos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alexis Roos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/\"},\"author\":{\"name\":\"Alexis Roos\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#\\\/schema\\\/person\\\/590e3e4872f83fe795d5a39eef3f9fae\"},\"headline\":\"Caching queries in Couchbase for high performance\",\"datePublished\":\"2014-12-16T19:21:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/\"},\"wordCount\":934,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"keywords\":[\"caching\",\"views\"],\"articleSection\":[\"High Performance\",\"SQL++ \\\/ N1QL Query\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/\",\"name\":\"Caching Queries Results for High Performance | Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2014-12-16T19:21:01+00:00\",\"description\":\"This blog provides examples of how query results can be cached into Couchbase to be retrieved from the cache instead of being served from index on disk.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/caching-queries-couchbase-high-performance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/ko\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Caching queries in Couchbase for high performance\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/#\\\/schema\\\/person\\\/590e3e4872f83fe795d5a39eef3f9fae\",\"name\":\"Alexis Roos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1af4f7380fe5fbd14381a9496c85b09b40d47524abcf8d3c68706a59b80c00c7?s=96&d=mm&r=g0ab9bfaebda64901a6d385eb29a1eb04\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1af4f7380fe5fbd14381a9496c85b09b40d47524abcf8d3c68706a59b80c00c7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/1af4f7380fe5fbd14381a9496c85b09b40d47524abcf8d3c68706a59b80c00c7?s=96&d=mm&r=g\",\"caption\":\"Alexis Roos\"},\"description\":\"Alexis Roos is senior engineering manager at Salesforce. Alexis has over 20 years of software engineering experience with the last five years focused on large-scale data science and engineering, working for SIs in Europe, Sun Microsystems\\\/Oracle, and several startups, including Radius Intelligence, Concurrent, and Couchbase.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/author\\\/alexis-roos\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Caching Queries Results for High Performance | Couchbase","description":"This blog provides examples of how query results can be cached into Couchbase to be retrieved from the cache instead of being served from index on disk.","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\/caching-queries-couchbase-high-performance\/","og_locale":"es_MX","og_type":"article","og_title":"Caching queries in Couchbase for high performance","og_description":"This blog provides examples of how query results can be cached into Couchbase to be retrieved from the cache instead of being served from index on disk.","og_url":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/","og_site_name":"The Couchbase Blog","article_published_time":"2014-12-16T19:21:01+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Alexis Roos","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alexis Roos","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/"},"author":{"name":"Alexis Roos","@id":"https:\/\/www.couchbase.com\/blog\/es\/#\/schema\/person\/590e3e4872f83fe795d5a39eef3f9fae"},"headline":"Caching queries in Couchbase for high performance","datePublished":"2014-12-16T19:21:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/"},"wordCount":934,"commentCount":4,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","keywords":["caching","views"],"articleSection":["High Performance","SQL++ \/ N1QL Query"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/","url":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/","name":"Caching Queries Results for High Performance | Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","datePublished":"2014-12-16T19:21:01+00:00","description":"This blog provides examples of how query results can be cached into Couchbase to be retrieved from the cache instead of being served from index on disk.","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/es\/caching-queries-couchbase-high-performance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/ko\/"},{"@type":"ListItem","position":2,"name":"Caching queries in Couchbase for high performance"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/es\/#website","url":"https:\/\/www.couchbase.com\/blog\/es\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/es\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/es\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/es\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","width":"1024","height":"1024","caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/es\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/es\/#\/schema\/person\/590e3e4872f83fe795d5a39eef3f9fae","name":"Alexis Roos","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/1af4f7380fe5fbd14381a9496c85b09b40d47524abcf8d3c68706a59b80c00c7?s=96&d=mm&r=g0ab9bfaebda64901a6d385eb29a1eb04","url":"https:\/\/secure.gravatar.com\/avatar\/1af4f7380fe5fbd14381a9496c85b09b40d47524abcf8d3c68706a59b80c00c7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1af4f7380fe5fbd14381a9496c85b09b40d47524abcf8d3c68706a59b80c00c7?s=96&d=mm&r=g","caption":"Alexis Roos"},"description":"Alexis Roos is senior engineering manager at Salesforce. Alexis has over 20 years of software engineering experience with the last five years focused on large-scale data science and engineering, working for SIs in Europe, Sun Microsystems\/Oracle, and several startups, including Radius Intelligence, Concurrent, and Couchbase.","url":"https:\/\/www.couchbase.com\/blog\/es\/author\/alexis-roos\/"}]}},"acf":[],"authors":[{"term_id":21,"user_id":15,"is_guest":0,"slug":"alexis-roos","display_name":"Alexis Roos","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/39","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\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=39"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/39\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/18"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=39"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}