ݺߣ

ݺߣShare a Scribd company logo
NewSQL: SQL никуда не
уходит
Константин,
Осипов
Developer http://tarantool.org
Содержание
● вспоминаем, зачем был нужен NoSQL
● что из NoSQL выдержало испытание временем
● SQL в NoSQL: смотрим на N1QL и CQL.
● NoSQL уже мёртв, а NewSQL ещё не рождён: чем тёплый, ламповый SQL
отличается от SQL в NoSQL
● ищем уникальные ценности NoSQL
● изучаем Multi-Model databases и NewSQL
NoSQL tenets
● #nosql hashtag
● горизонтальное масштабирование
● новые модели данных
● новые модели консистентности
NoSQL - выход для фрустрации, тэг который присвоили себе все кому оказалось
недостаточно возможностей SQL
Трудности масштабирования
Трудности масштабирования
Трудности масштабирования
Трудности масштабирования
Redis Cluster implements all the single key commands
available in the non-distributed version of Redis.
Commands performing complex multi-key operations like
Set type unions or intersections are implemented as well
as long as the keys all belong to the same node.
JSON в реляционных БД
MySQL PostgreSQL Redis Couchbase Cassandra Neo4J
Хранение JSON Yes Yes Yes Yes Yes Yes!
JSON field ops Yes Yes Yes Yes No No
JSON query Yes Yes No Yes Yes No
JSON secondary
index
Yes Yes No Yes No No
NoSQL сегодня
● горизонтальное масштабирование
● новые модели данных document and graph data models
● новые модели консистентности
SQL в NoSQL
MongoDB Couchbase Cassandra Redis
Cхема данных Yes* No Yes No
NULLs/Absent values Yes* Yes Yes No
JOINs No Yes No No
Secondary keys Yes* Yes Yes, but.. No
GROUP BY Yes* Yes No No
JDBC/ODBC No Yes No No
N1QL: отличия от SQL
● NEST/UNNEST
● LETTING -> AS
● IS MISSING -> IS NULL
● IS VALUED -> IS NOT UNKNOWN
● IN [] -> IN ()
SQL в NoSQL: консистентность
Couchbase:
Because indexes are by design outside the data service, they are eventually
consistent with respect to changes to documents and, depending on how you
issue the query, may at times not contain the most up-to-date information.
This may especially be the case when deployed in a write-heavy environment:
changes may take some time to propagate over to the index nodes.
Crate.io:
Crate does not provide transactions.
NoSQL: ищем ценности
● multi-model databases
● domain-specific languages
● UPSERT
Новые языки запросов к данным
● RethinkDB ReQL
● Elasticsearch Query Language
○ MIN/MAX/AVG
○ derivative/percentiles/histogram/cumulative sum/serial diff
● JSONIQ
● GraphQL
● SparQL
● Pregel
-> Сообщество по-прежнему недовольно SQL !
-> потоковая, итеративная парадигма данных вместо реляционной
алгебры
Multi-model databases: о чём это
Multi-model databases (2)
Multi-model databases (3)
UPSERT: зачем это
● SQL по своей семантике не содержит non-reading update
● LSM структуры данных неэффективны для операций чтения
● необходим оператор с новой семантикой
После NewSQL: temporal database
● time period datatype, including the ability to represent time periods with no end (infinity or
forever)
● the ability to define valid and transaction time period attributes and bitemporal relations
● system-maintained transaction time
● temporal primary keys, including non-overlapping period constraints
● temporal constraints, including non-overlapping uniqueness and referential integrity
● update and deletion of temporal records with automatic splitting and coalescing of time periods
● temporal queries at current time, time points in the past or future, or over durations
● predicates for querying time periods, often based on Allen’s interval relations
После NewSQL: temporal database
После NewSQL: temporal database
После NewSQL: temporal database
SELECT * FROM Employee
FOR SYSTEM_TIME
BETWEEN '2014-01-01 00:00:00.0000000'
AND '2015-01-01 00:00:00.0000000'
WHERE EmployeeID = 1000 ORDER BY
ValidFrom;
@kostja_osipov
Konstantin
Osipov
Developer tarantool.org
Вопросы?
tarantooldb
tarantool.orgkostja@tarantool.org
Ссылки
● https://developer.couchbase.com/documentation/server/current/developer-guide/query-consistency.html
● https://martinfowler.com/books/nosql.html
● http://jimwebber.org/2011/02/on-sharding-graph-databases/
● https://docs.mongodb.com/manual/core/document-validation/
● http://www.oreilly.com/pub/e/3847
● https://www.oreilly.com/ideas/data-modeling-with-multi-model-databases
● https://redislabs.com/blog/redis-as-a-json-store/

More Related Content

Константин Осипов

  • 1. NewSQL: SQL никуда не уходит Константин, Осипов Developer http://tarantool.org
  • 2. Содержание ● вспоминаем, зачем был нужен NoSQL ● что из NoSQL выдержало испытание временем ● SQL в NoSQL: смотрим на N1QL и CQL. ● NoSQL уже мёртв, а NewSQL ещё не рождён: чем тёплый, ламповый SQL отличается от SQL в NoSQL ● ищем уникальные ценности NoSQL ● изучаем Multi-Model databases и NewSQL
  • 3. NoSQL tenets ● #nosql hashtag ● горизонтальное масштабирование ● новые модели данных ● новые модели консистентности NoSQL - выход для фрустрации, тэг который присвоили себе все кому оказалось недостаточно возможностей SQL
  • 7. Трудности масштабирования Redis Cluster implements all the single key commands available in the non-distributed version of Redis. Commands performing complex multi-key operations like Set type unions or intersections are implemented as well as long as the keys all belong to the same node.
  • 8. JSON в реляционных БД MySQL PostgreSQL Redis Couchbase Cassandra Neo4J Хранение JSON Yes Yes Yes Yes Yes Yes! JSON field ops Yes Yes Yes Yes No No JSON query Yes Yes No Yes Yes No JSON secondary index Yes Yes No Yes No No
  • 9. NoSQL сегодня ● горизонтальное масштабирование ● новые модели данных document and graph data models ● новые модели консистентности
  • 10. SQL в NoSQL MongoDB Couchbase Cassandra Redis Cхема данных Yes* No Yes No NULLs/Absent values Yes* Yes Yes No JOINs No Yes No No Secondary keys Yes* Yes Yes, but.. No GROUP BY Yes* Yes No No JDBC/ODBC No Yes No No
  • 11. N1QL: отличия от SQL ● NEST/UNNEST ● LETTING -> AS ● IS MISSING -> IS NULL ● IS VALUED -> IS NOT UNKNOWN ● IN [] -> IN ()
  • 12. SQL в NoSQL: консистентность Couchbase: Because indexes are by design outside the data service, they are eventually consistent with respect to changes to documents and, depending on how you issue the query, may at times not contain the most up-to-date information. This may especially be the case when deployed in a write-heavy environment: changes may take some time to propagate over to the index nodes. Crate.io: Crate does not provide transactions.
  • 13. NoSQL: ищем ценности ● multi-model databases ● domain-specific languages ● UPSERT
  • 14. Новые языки запросов к данным ● RethinkDB ReQL ● Elasticsearch Query Language ○ MIN/MAX/AVG ○ derivative/percentiles/histogram/cumulative sum/serial diff ● JSONIQ ● GraphQL ● SparQL ● Pregel -> Сообщество по-прежнему недовольно SQL ! -> потоковая, итеративная парадигма данных вместо реляционной алгебры
  • 15. Multi-model databases: о чём это
  • 18. UPSERT: зачем это ● SQL по своей семантике не содержит non-reading update ● LSM структуры данных неэффективны для операций чтения ● необходим оператор с новой семантикой
  • 19. После NewSQL: temporal database ● time period datatype, including the ability to represent time periods with no end (infinity or forever) ● the ability to define valid and transaction time period attributes and bitemporal relations ● system-maintained transaction time ● temporal primary keys, including non-overlapping period constraints ● temporal constraints, including non-overlapping uniqueness and referential integrity ● update and deletion of temporal records with automatic splitting and coalescing of time periods ● temporal queries at current time, time points in the past or future, or over durations ● predicates for querying time periods, often based on Allen’s interval relations
  • 22. После NewSQL: temporal database SELECT * FROM Employee FOR SYSTEM_TIME BETWEEN '2014-01-01 00:00:00.0000000' AND '2015-01-01 00:00:00.0000000' WHERE EmployeeID = 1000 ORDER BY ValidFrom;
  • 24. Ссылки ● https://developer.couchbase.com/documentation/server/current/developer-guide/query-consistency.html ● https://martinfowler.com/books/nosql.html ● http://jimwebber.org/2011/02/on-sharding-graph-databases/ ● https://docs.mongodb.com/manual/core/document-validation/ ● http://www.oreilly.com/pub/e/3847 ● https://www.oreilly.com/ideas/data-modeling-with-multi-model-databases ● https://redislabs.com/blog/redis-as-a-json-store/