{"id":87341,"date":"2020-10-12T16:00:44","date_gmt":"2020-10-12T13:00:44","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/what-is-a-nosql-database-and-what-are-they-good-for-cloudsavvy-it\/"},"modified":"2020-10-12T16:00:44","modified_gmt":"2020-10-12T13:00:44","slug":"what-is-a-nosql-database-and-what-are-they-good-for-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/what-is-a-nosql-database-and-what-are-they-good-for-cloudsavvy-it\/","title":{"rendered":"#What is a NoSQL Database, and What Are They Good For? \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a3d8d14054bc\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a3d8d14054bc\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-a-nosql-database-and-what-are-they-good-for-cloudsavvy-it\/#The_Limitation_of_SQL_Scalability\" >The Limitation of SQL: Scalability<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-a-nosql-database-and-what-are-they-good-for-cloudsavvy-it\/#NoSQL_vs_SQL_Structure\" >NoSQL vs. SQL Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/what-is-a-nosql-database-and-what-are-they-good-for-cloudsavvy-it\/#What_Are_NoSQL_Databases_Good_For\" >What Are NoSQL Databases Good For?<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#What is a NoSQL Database, and What Are They Good For? \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-332\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/6793d4a5fe2415c3b6583adadb0e27db\/p\/uploads\/2019\/05\/3beb9480.png\" alt=\"\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>A NoSQL database is any kind of database that breaks away from the traditional design of SQL. NoSQL databases like the document-based MongoDB have become more popular in recent years. What\u2019s all the hype about?<\/p>\n<h2><span class=\"ez-toc-section\" id=\"The_Limitation_of_SQL_Scalability\"><\/span>The Limitation of SQL: Scalability<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>SQL has been around forever\u201445 years. It holds up surprisingly well, and modern implementations of SQL are very fast. But, as the web has grown, so has the need for powerful databases that scale up to meet demand.<\/p>\n<p>The easiest way to scale a SQL database is to run it on a more powerful computer. SQL databases can be replicated to reduce regional load on an individual instance, but splitting a table up (often called <em>sharding<\/em>) is much harder for SQL.<\/p>\n<p>Document-based NoSQL databases fix this problem by design. Each document is independent from other documents in the collection, so the collections can be split over multiple servers much easier. Many document databases will include built in tools for sharding the data across different servers.<\/p>\n<p>But, the scalability problem isn\u2019t really an issue until you have a\u00a0<em>lot<\/em> of data. You can easily run a SQL database with hundreds of thousands of users and have no issues, assuming your structure is sound and your queries are fast.<\/p>\n<p>Both MySQL and MongoDB will likely get the job done for your <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lication, so the choice between the two comes down to which structure and syntax you prefer. Ease of development is important, and you may find that the document model and syntax of the much newer MongoDB is easier to work with than SQL.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"NoSQL_vs_SQL_Structure\"><\/span>NoSQL vs. SQL Structure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Traditional SQL databases are often called <em>relational databases<\/em> because of the way they are structured. In a SQL database, you will have multiple tables, each containing multiple rows (called <em>records<\/em>), which themselves have multiple different columns, or <em>attributes<\/em>. Each separate table is linked to the other through a primary key, which forms a relation.<\/p>\n<p>For example, imagine you have a table with each record representing a post made by a user. The primary key here is the username, which can be used to link the posts table to the users table. If you wanted to find the email of whoever made the post, you\u2019d perform a search for \u201cJon1996\u201d in the users table, and select the \u201cEmail\u201d field.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-318\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/fc17afafa01aa55ad3b24de6233bcf1d\/p\/uploads\/2019\/05\/6807b892.png\" alt=\"\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>But this data structure might not work for everyone. SQL databases have a rigidly defined schema, which can get in the way if you need to make changes or would just prefer to have a different layout. With complex datasets, the relations between everything can grow more complicated than the data itself.<\/p>\n<p>The main kind of NoSQL database is a JSON document database, like <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.mongodb.com\/\">MongoDB<\/a>. Instead of storing rows and columns, all the data is stored in individual documents. These documents are stored in collections (e.g., a \u201cuser\u201d document would be stored in a \u201call users\u201d collection) and don\u2019t have to have the same structure as other documents in the collection.<\/p>\n<p>For example, a \u201cuser\u201d document may look something like this:<\/p>\n<pre>{&#13;\n  \"username\":\"Jon1996\",&#13;\n  \"email\":\"jon1996@gmail.com\",&#13;\n  \"posts\": [&#13;\n   {\"id\":1},&#13;\n   {\"id\":2},&#13;\n   {\"id\":3},&#13;\n  ]&#13;\n}<\/pre>\n<p>The username and email fields are just key-value pairs, similar to columns in SQL, but the \u201cposts\u201d field contains an array, which is not something you will find in SQL databases. Now say we had a posts collection with documents like:<\/p>\n<pre>{&#13;\n  \"id\":1,&#13;\n  \"title\":\"First Post\",&#13;\n  \"content\":\"Hello, World!\",&#13;\n  \"madeby\":\"Jon1996\"&#13;\n}<\/pre>\n<p>Now, when someone visits Jon\u2019s page, your application can fetch three posts with the IDs of 1, 2, and 3, which is usually a fast query. Compared to SQL, where you may have to fetch all posts that match Jon\u2019s user ID. Still quite fast, but the MongoDB query is more direct and makes more sense.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_Are_NoSQL_Databases_Good_For\"><\/span>What Are NoSQL Databases Good For?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>NoSQL is a broad category, and includes many different kinds of databases built with different goals. Each database is a tool, and your job may require a specific kind of tool, or even multiple different tools.<\/p>\n<p><strong>SQL databases<\/strong> like <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.mysql.com\/\">MySQL<\/a>, <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.oracle.com\/database\/\">Oracle<\/a>, and <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.postgresql.org\/\">PostgreSQL<\/a>\u00a0have been around since before the internet. They\u2019re very stable, have lots of support, and can <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/general\/\" data-internallinksmanager029f6b8e52c=\"3\" title=\"General\" target=\"_blank\" rel=\"noopener\">general<\/a>ly do the job for most people. If your data is valuable to you, and you want an established, consistent solution, stick with SQL.<\/p>\n<p><strong>JSON document databases<\/strong>, like <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.mongodb.com\/\">MongoDB<\/a> and <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.couchbase.com\/\">Couchbase<\/a>, are popular for web applications with changing data models, and for storing complex documents. For example, a site like Amazon may often have to change the data model for storing products on the site, so a document based database may work well for them.<\/p>\n<p>Document databases are intended to be the generic replacement to SQL, and are probably what you think of when you hear \u201cNoSQL.\u201d They\u2019re also more intuitive to learn than SQL, since you won\u2019t have to manage relations between tables or complex queries.<\/p>\n<p><strong><a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.rethinkdb.com\/\">RethinkDB<\/a><\/strong>\u00a0is a JSON document database built for realtime applications. In a database like MongoDB, you\u2019d need to poll for updates every few seconds, or implement some API on top of that to track realtime updates, which gets heavy quickly. RethinkDB solves this issue by pushing updates automatically over websocket streams that clients can connect to.<\/p>\n<p><a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/redis.io\/\"><strong>Redis<\/strong><\/a> is an extremely performant key-value database that stores small keys and strings entirely in RAM, which is much faster to read and write to than even the quickest SSDs. It\u2019s often used alongside other databases as an in-memory cache for small data that gets written to and read from often. For example, a messaging app might want to use Redis to store user\u2019s messages (and even push updates in realtime with their <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/redis.io\/topics\/pubsub\">Pub\/Sub methods<\/a>). Storing many small messages this way might cause performance issues with other types of databases.<\/p>\n<p><strong>Graph databases<\/strong> are built for storing connections between data. A common use case is <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/social-mediaa\/\" data-internallinksmanager029f6b8e52c=\"1\" title=\"Social Media\" target=\"_blank\" rel=\"noopener\">social<\/a> networks, where users are connected to each other and interacting with other data, such as posts they\u2019ve made.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-326\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/eb6cfbd8a2beff87c427a406ba227a68\/p\/uploads\/2019\/05\/8e629038.png\" alt=\"\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>In this example, George is friends with two people, Jon and Jane. If another kind of database wanted to understand George\u2019s connection to Sarah, they\u2019d have to query all of Jon\u2019s friends and all of Jane\u2019s friends. But graph databases understand this connection intuitively; for the friends of friends query, the popular graph database\u00a0<a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/neo4j.com\/\">Neo4J<\/a> is <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/medium.com\/the-andela-way\/graph-databases-why-are-they-important-c438e1a224ae\">60% faster than MySQL<\/a>. For friends of friends of friends (3 levels deep) Neo4J is <em>180 times faster<\/em>.<\/p>\n<p><strong>Wide column databases<\/strong>\u00a0like <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/cassandra.apache.org\/\">Cassandra<\/a> and <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/hbase.apache.org\/\">Hbase<\/a>, are used for storing massive amounts of data. They\u2019re built for datasets that are so large you need multiple computers to store it all, and they\u2019re <a rel=\"nofollow noopener noreferrer\" target=\"_blank\" href=\"https:\/\/www.datastax.com\/apache-cassandra-leads-nosql-benchmark\">much faster<\/a>\u00a0than SQL and other NoSQL databases when spread over multiple nodes.\n<\/div>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/316\/what-is-a-nosql-database-and-what-are-they-good-for\/\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#What is a NoSQL Database, and What Are They Good For? \u2013 CloudSavvy IT&#8221; A NoSQL database is any kind of database that breaks away from the traditional design of SQL. NoSQL databases like the document-based MongoDB have become more popular in recent years. What\u2019s all the hype about? The Limitation of SQL: Scalability SQL&#8230;<\/p>\n","protected":false},"author":1,"featured_media":87342,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2019\/05\/3beb9480.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-87341","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/87341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=87341"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/87341\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/87342"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=87341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=87341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=87341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}