Information in 2020: Features You Only Get with RavenDB
We have been developing RavenDB for over a decade.
In that time, we have loaded your database to include tons of features that make your life a lot better. Quite often, many deep-level features get overlooked, denying you the chance to get the most out of your database.
Some of these "unsung" features are incredibly useful, but you need to know about them to take full advantage.
We have seen too many development teams trip over the fallacies of distributed computing. Project Managers are fooled into making decisions based on the following assumptions:
- The network is reliable
- Latency is zero
- Bandwidth is infinite
- The network is secure
- Topology doesn't change
- There is one administrator
- Transport cost is zero
- The network is homogeneous
The primary reason we fall into the trap of these assumptions is that we develop our projects on a single local computer where all of these "rules" seem to apply. Once we go to production under a globally distributed system, your system can unravel.
We design a lot of RavenDB features to prevent you from feeling the effects of these fallacies once your applications go to production.
Going live should be a seamless and exciting experience!
Data includes involve including related data to a query inside your server request.
For example, say I want to do a query of all customers in Nevada who spent more than $50 on their last purchase.
A standard query requires a server to request the customer name, their address, and their last purchase. Usually, this information will appear in separate documents. It may take multiple trips to your database server to full this request.
Using data includes, RavenDB will grab all relevant information in a single server request to minimize trips to the server. In the example query Oren gave, the initial costs were 2.6 seconds over 11 queries. Once he used data includes, the time cost fell by over 90% requiring only one server request.
Data includes can significantly reduce your total query time and network calls, cutting your cloud costs with every request your user makes.
For every query you make, the RavenDB index optimizer will determine which index currently in memory will fulfill your query the fastest. In other databases, if there is no index available, you might have to perform an entire table scan, which can be very time expensive.
RavenDB will create an index for you automatically and on the fly. RavenDB will process all your queries quickly and efficiently by making sure there is a fast lane to every piece of data you need.
RavenDB's automatic caching feature only processes requests where data result sets change. If a result set is already in the server, rather than perform the query again, RavenDB will return the results already in memory. If 1,000 users query the same results set, instead of paying for 1,000 queries, you only have to pay for one.
RavenDB will save you massive amounts of time, latency, and money by confirming that the data set didn't change and to tell your server to use what's in memory. This saves your application the time and cost of sending the query over the network, processing the request, packaging the result set, and returning it back to the server thousands of times for each redundant query.
Using Automatic caching, RavenDB takes it one step further. Once a result set has changed, RavenDB will alert you that something changed. This saves you a trip to the server by not having to query the result set to confirm it is the same one you can take from memory.
To see the code Oren developed to demonstrate these features, you can go to his GitHub page.