DBDB.io The Encyclopedia of Database Systems · Est. 2017
Database of Databases

Database Entry

SingleStore


SingleStore is a distributed in-memory relational database designed for both transactional and analytical workloads.

Country of Origin
US
Start Year
2011 [22][23]
Former Name
MemSQL
Project Type
Commercial
Supported Languages
C++
Inspired By
Hekaton
Compatible With
MySQL
Operating System
Linux
License
Proprietary

Database Entry

SingleStore


SingleStore is a distributed in-memory relational database designed for both transactional and analytical workloads.

History[05][06]


SingleStore was originally founded as MemSQL as a Y-combinator graduate company in 2011.

The company renamed the system to SingleStore in October 2020.

Checkpoints[07]


SingleStore uses multi-version concurrency control and it's natural to create a consistent(non-fuzzy) snapshot without the need to block ongoing transactions.

Concurrency Control[08]


SingleStore uses multi-version concurrency control. Reads are not blocked, writes acquire row-level locks.

Data Model[08]


SingleStore is a distributed relational database. It also supports two-column key/value store.

Foreign Keys[09]


SingleStore currently supports foreign keys to assist sharding, but referential integrity is not enforced.

Indexes[10][11]


Skip list is the default index type in MemSQL. Skip list is lock free and thus leads extremely fast insert performance, and O(lg(n)) expected lookup/insert/delete performance. Unlike B+ tree, skip list is singly linked, thus reserve scan leads to twice as costly as forward scan. Skip list involves more pointer chasing than B+ tree which could potentially lead to more cache misses. In MemSQL, heuristics are applied to organize nearby nodes on the same physical page to mitigate penalties caused by pointer chasing. Lock-free hash table is also supported in MemSQL to perform fast exact-match queries.

Isolation Levels[12]


SingleStore supports read committed isolation level.

Joins[13][14][15]


Nested loop join, index-nested loop join, merge join and hash join are supported in SingleStore. Joins between two Columnstore tables are often executed as sort merge join. For distributed join queries, if two tables are joined with identical shard key, the join will be performed locally; otherwise dataset is broadcast to other nodes via the network.

Logging[16]


SingleStore implements write-ahead-logging which records only committed transactions. It uses a transaction buffer pool as back-pressure mechanism so that a worker thread does not generate indefinite amount of logs. Replication is implemented based on log recovery.

Query Compilation[17][10]


Instead of the traditional interpreter based execution model, MemSQL 5 comes with a new code generation architecture, which compiles a SQL query to LLVM to machine code. When the SingleStore server encounters a SQL query, it parses SQL into AST and extracts parameters from the query, which is then transformed into a MemSQL-specific intermediate representation in MemSQL Plan Language(MPL). MemSQL then flattens MPL AST into a more compact format as MemSQL Bytecode(MBC). Plans in MBC format is then transformed into LLVM Bitcode, which LLVM uses to generate machine code. Such code generation architecture enables many low-level optimizations and avoids much less unnecessary work compared to interpreter-based execution. Compiled plans are also cached on disk for future use.

Query Execution[14]


SingleStore uses Tuple-at-a-Time Model for rowstore query execution, uses Vectorized Model for columnstore.

Query Interface[09]


SQL

SingleStore supports a subset of MySQL syntax, plus extensions for distributed SQL, geospatial and JSON queries. MySQL wire protocol is supported.

Storage Architecture[18]


In SingleStore, rowstore is completely in-memory and columnstore is disk-backed.

Storage Model[18]


In SingleStore, row segments in rowstore are stored in N-ary storage model in-memory. Column segments in columnstore are stored in decomposition storage model. Clustered columnar indexes are created for columnstore and compression is applied.

Stored Procedures[09]


Stored procedure is not supported.

System Architecture[19][20]


SingleStore has a two-tier, clustered architecture. The nodes in upper tier are aggregators, which are cluster-aware query routers. One special node called Master Aggregator is responsible for clustering monitoring. The nodes in lower tier are leaves, which store and process partitioned shards. The aggregator sends extended SQL to leaves to perform distributed query execution.

Views[21]


Views in MemSQL is not materialzed and cannot be written into.

Citations

23 sources
  1. SingleStore | The Performance You Need for Enterprise AI singlestore.com
  2. SingleStore Helios · SingleStore Documentation singlestore.com
  3. SingleStore - Wikipedia wikipedia.org
  4. https://twitter.com/SingleStoreDB twitter.com
  5. MemSQL is Now SingleStore singlestore.com
  6. http://y-combinator.silk.co/page/MemSQL silk.co Dead — Check Archive
  7. https://docs.singlestore.com/docs/using-durability-and-recovery singlestore.com Dead — Check Archive
  8. https://docs.singlestore.com/docs/how-memsql-works singlestore.com Dead — Check Archive
  9. https://docs.singlestore.com/docs/mysql-features-unsupported-in-memsql singlestore.com Dead — Check Archive
  10. Schedule - CMU 15-721 :: Database Systems (Spring 2016) cmu.edu
  11. https://docs.singlestore.com/docs/indexes singlestore.com Dead — Check Archive
  12. https://docs.singlestore.com/docs/memsql-faq#section-what-isolation-levels-does-memsql-provide- singlestore.com Dead — Check Archive
  13. https://docs.singlestore.com/docs/query-tuning singlestore.com Dead — Check Archive
  14. https://docs.singlestore.com/4.0/concepts/columnstore singlestore.com Dead — Check Archive
  15. https://docs.singlestore.com/docs/explain singlestore.com Dead — Check Archive
  16. US9223805B2 - Durability implementation plan in an in-memory database system - Google Patents google.com
  17. https://docs.singlestore.com/docs/code-generation singlestore.com Dead — Check Archive
  18. https://docs.singlestore.com/docs/columnstore singlestore.com Dead — Check Archive
  19. https://docs.singlestore.com/docs/leaf singlestore.com Dead — Check Archive
  20. https://docs.singlestore.com/docs/aggregator singlestore.com Dead — Check Archive
  21. https://docs.singlestore.com/docs/create-view singlestore.com Dead — Check Archive
  22. https://angel.co/memsql angel.co
  23. https://techcrunch.com/2011/07/12/y-combinator-alum-memsql-raises-2-1-million-from-ashton-kutcher-sv-angel-and-more techcrunch.com
Revision #9