Date post: | 15-Apr-2017 |
Category: |
Documents |
Upload: | kevin-krueger |
View: | 184 times |
Download: | 1 times |
NOSQL FOR YOU
NoSQL for youAN INTRODUCTION TO DOCUMENT DATABASES USING RAVENDBKevin Krueger, Principal [email protected]
@kevinkrueger
NOSQL FOR YOU
What is NoSQL? “non SQL” or “not-only SQL” From Wikipedia: “provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases”
NOSQL FOR YOU
Types of NoSQL Databases Key-Value Store (Riak, Amazon Dynamo) Document Database (RavenDB, CouchDB, MongoDB) Graph Database (Neo4j)
NOSQL FOR YOU
DocumentDB (documents, not rows) Non-relational Schema-less Transactional* REST API and .Net Client
NOSQL FOR YOU
Why choose a Document Database instead of a Relational Database? There is an inherent mismatch between object models and relational models (aka the ORM impedance mismatch)◦ Set vs. graph relationships
ORMs end up being a leaky abstraction◦ Inefficient SQL (e.g. SELECT N+1 issue)◦ The database schema ends up driving your object model
NOSQL FOR YOU
Demos – Basic CRUD operations
NOSQL FOR YOU
Demo – Basic queries
NOSQL FOR YOU
Indexes Every query (beyond retrieval by document id) requires an index◦ Indexes teach Raven about your data◦ Raven uses Lucene.Net behind the scenes for indexing
Raven will automatically create indexes for you on the flyIt’s better to explicitly create them up frontIndexes can be stale (eventual consistency)
NOSQL FOR YOU
Demo – Static indexes
NOSQL FOR YOU
Things to be aware of: Raven is built with a “safe by default” principle
◦ These limits can surprise you Eventual consistency requires careful consideration
◦ Your application’s behavior shouldn’t depend on indexes being non-stale
NOSQL FOR YOU
Bundles Bundles are packages of additional functionality that can optionally be installed. Examples:◦ Authorization◦ Cascade delete◦ Encryption◦ More like this◦ Unique constraints◦ Versioning
NOSQL FOR YOU
Advanced topics for you to explore
Advanced indexes◦ Multi-map indexes
Transformers: server side projections Listeners: client-side extension points
◦ Example types: Store listeners, Conversion listeners Data subscriptions (pub/sub) Patching API: useful for updating denormalized data In-memory mode: great for unit tests
NOSQL FOR YOU
Thoughts on NoSQL It’s not a one-size fits all solution. Sometimes NoSQL doesn’t make a lot of sense:
◦ e.g. Ad-hoc reporting It’s another tool to put in your tool belt. Use it strategically where it makes sense.◦ Semi-structured data◦ Hierarchical data
NOSQL FOR YOU
Summary Raven is a NoSQL Document Database Documents are stored in JSON The .Net API supports queries using Linq Indexes specify the fields in your documents that can be searched on
NOSQL FOR YOU
Resources RavenDB: http://ravendb.net/ RavenHQ: http://ravenhq.com/ Pluralsight course: Introduction to Raven DB http://www.pluralsight.com/
NOSQL FOR YOU
Questions?