NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)
-
Upload
binary-studio -
Category
Software
-
view
302 -
download
0
Transcript of NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)
![Page 1: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/1.jpg)
NoSQL vs SQL
![Page 2: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/2.jpg)
Who am I?Beseda DmitriyWeb developer at Binary Studio
email: [email protected]: [email protected]: dmitriy.b_binaryfacebook: https://www.facebook.com/profile.php?id=100001784445579
![Page 3: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/3.jpg)
Plan1.Data nowadays
2.SQL advantages / disadvantages
3.NoSQL advantages / disadvantages
4.NoSQL history
5.SQL and NoSQL similarities and differences
6.ORM / ODM
7.Myths
8.Conclusions
![Page 4: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/4.jpg)
Problem
Main “Bottleneck”
![Page 5: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/5.jpg)
Data evolution- Data and web apps are growing rapidly day by day
- Hardware cannot keep pace with data growth
- Apps are moving to Cloud and becoming API driven
Conclusion: It is hard to scale data in a traditional way
![Page 6: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/6.jpg)
Data in businessBusiness is successful if data are used properly
- Statistic, reports
- Real-time
- Recommendations
Conclusion:
- Web apps should be real-time and interactive
- User and services databases grow from tera to peta bytes each day
![Page 7: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/7.jpg)
Pay attention●CRUD (Create Read Update Delete) operations
- Performance
- Reliability
●Data consistency (ACID) & Distributed network- Parallel immediate access
- Updates applying time to all users
●Loading- Data replication
- Sharding
![Page 8: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/8.jpg)
Advantages:
●No duplications
●Data integrity
●Transactions
●Actions sequence
●Security
●Data consistency
SQLDisadvantages:
●Performance
●Work in distributed environment (locks)
●Horizontal scaling complexity
●Additional language to manipulate with data
●Scaling and Sharding
![Page 9: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/9.jpg)
SQL Products and customers
December, 2015
![Page 10: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/10.jpg)
NoSQLAdvantages:
●Performance (aggregation)
●Schemaless (easy to add / remove properties)
●Horizontal scaling (& sharding)
●Way of using memory
●Open source
Disadvantages:
●Absence of transactions
●Embedding limitations
●Lots of manual work (joins are absent)
●Model format is not guaranteed
![Page 11: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/11.jpg)
NoSQL products and customers
![Page 12: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/12.jpg)
NoSQL historyIn 1998 Carlo Strozzi implemented an open source DB, that stored ASCII files and used shell scripts for data manipulations
In June 2009 Eric Evans proposed NoSQL as a Twitter #tag for a conference for existing distributed databases
![Page 13: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/13.jpg)
- Consistency - “Is the data I am looking at now the same if I look at it somewhere else”
- Availability - “What will happen if my database goes down?”
- Partitioning - “What if my data is on a different node?”
SQL - CANoSQL - AP
CAP theorem (Consistency, Availability and Partition-tolerance)
![Page 14: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/14.jpg)
SQL and NoSQL similarities●Primary key or Id is necessary and unique
●Indexes help to increase performance
●Relationships exist
![Page 15: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/15.jpg)
Goals of normalization- Free the database of modification anomalies (references)
- Minimize redesign
- Avoid any bias toward any particular access pattern
![Page 16: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/16.jpg)
SQL schema example
![Page 17: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/17.jpg)
Schema design- Rich documents- Pre join / embed Data- No more joins- No constraints- Atomic operations- No declared schema
![Page 18: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/18.jpg)
NoSQL types●Key Value (Firebase, Dynamo, Redis ...)
●Document (MongoDB, CouchDB)
●Graph (InfoGrid, Neo4J ...)
●Column Family (Cassandra, HyperTable, BigTable)
![Page 19: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/19.jpg)
Data store positioning
SQL Comfort zone
Key Value
Column
Document
GraphRelational
Standardized Model, Tooling, Complexity
Sca
labi
lity
![Page 20: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/20.jpg)
JSON- Array
var array = [ 1, 2, 3, 4, 5]
- Dictionaries
var doc = {
"prop1": "some string","prop2": { a: 2, b: 3},"prop3": array
}
![Page 21: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/21.jpg)
NoSQL document example{
"_id": ObjectId,"description": String,"total": Number,"notes": [{
"_id": ObjectId,"text": String
}],"exclusions": [{
"_id": ObjectId,"text": String
}],"categories": {
"ref1": {"name": String,"status": String,"price": Number
},"ref2": {
"name": String,"status": String,"price": Number
}}
}
![Page 22: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/22.jpg)
ORM and ODMORM:
●Entity Framework (.NET)
●Nhibernate (.NET)
●Hibernate (Java)
●Django (Python)
●Sequelize (JS)
ODM:
●Mongoose (Mongo)
![Page 23: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/23.jpg)
Myths- NoSQL supersedes SQL
- NoSQL is better / worse than SQL
- SQL vs NoSQL is a clear distinction
- The language/framework determines the database
![Page 24: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/24.jpg)
Use SQL if:●Data integrity is essential
●Standards-based proven technologies with good developer experience and support
●Logical related discrete data requirements which can be identified up-front
●Prefer SQL
![Page 25: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/25.jpg)
Use NoSQL if:●Data requirements are unrelated, indeterminate or evolving
●Project objectives are simpler of less specific and allow starting to code immediately
●Speed and scalability is imperative
●Prefer NoSQL
![Page 26: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/26.jpg)
Always remember● Если бы мы действительно ждали завершения каждой транзакции в мировой сети ATM (банкоматов),
транзакции занимали бы столько времени, что клиенты убегали бы прочь в ярости. Что происходит, если ты и твой партнер снимаете деньги одновременно и превышаете лимит? — Вы оба получите деньги, а мы поправим это позже.
● Мы вступаем в эру polyglot persistence — эру, когда для различных потребностей используются разные хранилища данных. Теперь нет монополизма реляционных баз данных, как безальтернативного источника данных. Все чаще архитекторы выбирают хранилище исходя из природы самих данных и того, как мы ими хотим манипулировать, какие объемы информации ожидаются. И поэтому все становится только интереснее.
● A well-designed SQL database will almost certainly perform better than a badly designed NoSQL equivalent and vice versa.
![Page 27: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/27.jpg)
![Page 28: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/28.jpg)
SummarySQL - works great, isn’t scalable for large data 😞NoSQL - works great, isn’t suitable for everyone 😞SQL + NoSQL 😊
![Page 29: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/29.jpg)
References1.SQL vs NoSQL: The Differences
2.MongoDB university
![Page 30: NoSQL vs SQL (by Dmitriy Beseda, JS developer and coach Binary Studio Academy)](https://reader035.fdocuments.net/reader035/viewer/2022070516/586fbb6d1a28abe57d8b8a51/html5/thumbnails/30.jpg)
Questions?