{"id":1723,"date":"2022-12-06T09:51:12","date_gmt":"2022-12-06T09:51:12","guid":{"rendered":"https:\/\/blog.amt.in\/?p=1723"},"modified":"2022-12-06T09:51:12","modified_gmt":"2022-12-06T09:51:12","slug":"insights-to-nosql","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2022\/12\/06\/insights-to-nosql\/","title":{"rendered":"Insights to NoSQL !"},"content":{"rendered":"<p>A\u00c2\u00a0NoSQL\u00c2\u00a0(originally referring to &#8220;non-SQL&#8221; or &#8220;non-relational&#8221;)\u00c2\u00a0database\u00c2\u00a0provides a mechanism for\u00c2\u00a0storage\u00c2\u00a0and\u00c2\u00a0retrieval\u00c2\u00a0of data that is modeled in means other than the tabular relations used in\u00c2\u00a0relational databases. Such databases have existed since the late 1960s, but the name &#8220;NoSQL&#8221; was only coined in the early 21st century,\u00c2\u00a0triggered by the needs of\u00c2\u00a0Web 2.0\u00c2\u00a0companies.\u00c2\u00a0NoSQL databases are increasingly used in\u00c2\u00a0big data\u00c2\u00a0and\u00c2\u00a0real-time web\u00c2\u00a0applications.\u00c2\u00a0NoSQL systems are also sometimes called &#8220;Not only SQL&#8221; to emphasize that they may support\u00c2\u00a0SQL-like query languages or sit alongside SQL databases in\u00c2\u00a0polyglot-persistent\u00c2\u00a0architectures.<\/p>\n<p>Motivations for this approach include: simplicity of\u00c2\u00a0design, simpler\u00c2\u00a0&#8220;horizontal&#8221; scaling\u00c2\u00a0to\u00c2\u00a0clusters of machines\u00c2\u00a0(which is a problem for relational databases),\u00c2\u00a0finer control over\u00c2\u00a0availability\u00c2\u00a0and limiting the\u00c2\u00a0object-relational impedance mismatch.\u00c2\u00a0The data structures used by NoSQL databases (e.g.\u00c2\u00a0key\u00e2\u20ac\u201cvalue pair,\u00c2\u00a0wide column,\u00c2\u00a0graph, or\u00c2\u00a0document) are different from those used by default in relational databases, making some operations faster in NoSQL. The particular suitability of a given NoSQL database depends on the problem it must solve. Sometimes the data structures used by NoSQL databases are also viewed as &#8220;more flexible&#8221; than relational database tables.<\/p>\n<p>Many NoSQL stores compromise\u00c2\u00a0consistency\u00c2\u00a0(in the sense of the\u00c2\u00a0CAP theorem) in favor of availability, partition tolerance, and speed. Barriers to the greater adoption of NoSQL stores include the use of low-level query languages (instead of SQL, for instance), lack of ability to perform ad-hoc\u00c2\u00a0joins\u00c2\u00a0across tables, lack of standardized interfaces, and huge previous investments in existing relational databases.\u00c2\u00a0Most NoSQL stores lack true\u00c2\u00a0ACID\u00c2\u00a0transactions, although a few databases have made them central to their designs.<\/p>\n<p>Instead, most NoSQL databases offer a concept of &#8220;eventual consistency&#8221;, in which database changes are propagated to all nodes &#8220;eventually&#8221; (typically within milliseconds), so queries for data might not return updated data immediately or might result in reading data that is not accurate, a problem known as stale reads.\u00c2\u00a0Additionally, some NoSQL systems may exhibit lost writes and other forms of\u00c2\u00a0data loss. Some NoSQL systems provide concepts such as\u00c2\u00a0write-ahead logging\u00c2\u00a0to avoid data loss.\u00c2\u00a0For\u00c2\u00a0distributed transaction processing\u00c2\u00a0across multiple databases, data consistency is an even bigger challenge that is difficult for both NoSQL and relational databases. Relational databases &#8220;do not allow referential integrity constraints to span databases&#8221;.\u00c2\u00a0Few systems maintain both\u00c2\u00a0ACID\u00c2\u00a0transactions and\u00c2\u00a0X\/Open XA\u00c2\u00a0standards for distributed transaction processing.\u00c2\u00a0Interactive relational databases share conformational relay analysis techniques as a common feature.\u00c2\u00a0Limitations within the interface environment are overcome using semantic virtualization protocols, such that NoSQL services are accessible to most operating systems.<\/p>\n<p>The term\u00c2\u00a0<i>NoSQL<\/i>\u00c2\u00a0was used by Carlo Strozzi in 1998 to name his lightweight\u00c2\u00a0Strozzi NoSQL open-source relational database\u00c2\u00a0that did not expose the standard\u00c2\u00a0Structured Query Language\u00c2\u00a0(SQL) interface, but was still relational.\u00c2\u00a0His NoSQL RDBMS is distinct from the around-2009 general concept of NoSQL databases. Strozzi suggests that, because the current NoSQL movement &#8220;departs from the relational model altogether, it should therefore have been called more appropriately &#8216;NoREL'&#8221;,\u00c2\u00a0referring to &#8220;not relational&#8221;.<\/p>\n<p>Johan Oskarsson, then a developer at\u00c2\u00a0Last.fm, reintroduced the term\u00c2\u00a0<i>NoSQL<\/i>\u00c2\u00a0in early 2009 when he organized an event to discuss &#8220;open-source\u00c2\u00a0distributed, non-relational databases&#8221;.\u00c2\u00a0The name attempted to label the emergence of an increasing number of non-relational, distributed data stores, including open source clones of Google&#8217;s\u00c2\u00a0Bigtable\/MapReduce\u00c2\u00a0and Amazon&#8217;s\u00c2\u00a0DynamoDB.<\/p>\n<p>There are various ways to classify NoSQL databases, with different categories and subcategories, some of which overlap. What follows is a basic classification by data model, with examples:<\/p>\n<ul>\n<li>Wide column:\u00c2\u00a0Accumulo,\u00c2\u00a0Cassandra,\u00c2\u00a0Scylla,\u00c2\u00a0HBase.<\/li>\n<li>Document:\u00c2\u00a0Apache CouchDB,\u00c2\u00a0ArangoDB,\u00c2\u00a0BaseX,\u00c2\u00a0Clusterpoint,\u00c2\u00a0Couchbase,\u00c2\u00a0Cosmos DB,\u00c2\u00a0eXist-db,\u00c2\u00a0IBM Domino,\u00c2\u00a0MarkLogic,\u00c2\u00a0MongoDB,\u00c2\u00a0OrientDB,\u00c2\u00a0Qizx,\u00c2\u00a0RethinkDB<\/li>\n<li>Key\u00e2\u20ac\u201cvalue:\u00c2\u00a0Aerospike,\u00c2\u00a0Apache Ignite,\u00c2\u00a0ArangoDB,\u00c2\u00a0Berkeley DB,\u00c2\u00a0Couchbase,\u00c2\u00a0Dynamo,\u00c2\u00a0FoundationDB,\u00c2\u00a0InfinityDB,\u00c2\u00a0MemcacheDB,\u00c2\u00a0MUMPS,\u00c2\u00a0Oracle NoSQL Database,\u00c2\u00a0OrientDB,\u00c2\u00a0Redis,\u00c2\u00a0Riak,\u00c2\u00a0SciDB, SDBM\/Flat File\u00c2\u00a0dbm,\u00c2\u00a0ZooKeeper<\/li>\n<li>Graph:\u00c2\u00a0AllegroGraph,\u00c2\u00a0ArangoDB,\u00c2\u00a0InfiniteGraph,\u00c2\u00a0Apache Giraph,\u00c2\u00a0MarkLogic,\u00c2\u00a0Neo4J,\u00c2\u00a0OrientDB,\u00c2\u00a0Virtuoso<\/li>\n<\/ul>\n<p>Since most NoSQL databases lack ability for joins in queries, the\u00c2\u00a0database schema\u00c2\u00a0generally needs to be designed differently. There are three main techniques for handling relational data in a NoSQL database.<\/p>\n<h4><span id=\"Multiple_queries\" class=\"mw-headline\">Multiple queries:<\/span><\/h4>\n<p>Instead of retrieving all the data with one query, it is common to do several queries to get the desired data. NoSQL queries are often faster than traditional SQL queries so the cost of additional queries may be acceptable. If an excessive number of queries would be necessary, one of the other two approaches is more appropriate.<\/p>\n<h4><span id=\"Caching,_replication_and_non-normalized_data\" class=\"mw-headline\">Caching, replication and non-normalized data:<\/span><\/h4>\n<p>Instead of only storing foreign keys, it is common to store actual foreign values along with the model&#8217;s data. For example, each blog comment might include the username in addition to a user id, thus providing easy access to the username without requiring another lookup. When a username changes however, this will now need to be changed in many places in the database. Thus this approach works better when reads are much more common than writes.<\/p>\n<h4><span id=\"Nesting_data\" class=\"mw-headline\">Nesting data:<\/span><\/h4>\n<p>With document databases like MongoDB it is common to put more data in a smaller number of collections. For example, in a blogging application, one might choose to store comments within the blog post document so that with a single retrieval one gets all the comments. Thus in this approach a single document contains all the data you need for a specific task.<\/p>\n<p>The above is a brief about NoSQL. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A\u00c2\u00a0NoSQL\u00c2\u00a0(originally referring to &#8220;non-SQL&#8221; or<\/p>\n","protected":false},"author":1,"featured_media":1725,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[227,682,7],"tags":[228,683,18],"class_list":["post-1723","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-database","category-nosql","category-techtrends","tag-database","tag-nosql","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=1723"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1723\/revisions"}],"predecessor-version":[{"id":1724,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1723\/revisions\/1724"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/1725"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=1723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=1723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=1723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}