First, introduce
Memsql, known as the world's fastest distributed relational database, is compatible with MySQL but is 30 times times faster and can achieve 1.5 million transactions per second. The principle is to use only memory and precompile SQL to C + +.
Second, deploy
Official website: http://www.memsql.com/download/
-Installation
$ TAR-XZF memsqlbin_amd64.tar.gz
$ CD Memsqlbin
-Start
$./check_system
./memsqld-u Root--port 3307
-Close
$ killall Memsqld
Three, simple and practical
$ mysql-u root-h 127.0.0.1-p 3306--prompt= "memsql>" NOTE: here-h do not use localhost, 127.0.0.1memsql> show databases;+--- -----------------+| Database |+--------------------+| Information_schema | | Memsql |+--------------------+2 rows in Set (0.00 sec) Build Library:memsql> CREATE database chris001; Query OK, 0 rows affected (0.08 sec) memsql> show databases; +--------------------+| Database |+--------------------+| Information_schema | | Memsql | | chris001 |+--------------------+3 rows in Set (0.00 sec) Build table: memsql> use Chris001;database changedmemsql>m Emsql> CREATE TABLE test_001 (ID int primary key, name varchar (+), addr varchar ($), num int); Query OK, 0 rows affected (6.71 sec) memsql>memsql>memsql> Show tables;+--------------------+| tables_in_chris001 |+--------------------+| test_001 |+--------------------+1 row in Set (0.00 sec) memsql> desc test_001;+-------+--------------+----- -+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+--------------+------+-----+---------+-------+| ID | Int (11) | NO | PRI | NULL | || name | varchar (100) | YES | | NULL | || Addr | varchar (200) | YES | | NULL | || num | Int (11) | YES | | NULL | |+-------+--------------+------+-----+---------+-------+4 rows in Set (0.00 sec) after inserting data query: memsql> INSERT INTO Test_ 001 VALUES (1, ' Chris ', ' xxx ', 100); Query OK, 1 row affected (1.82 sec) memsql>memsql>memsql> select * from test_001;+----+-------+------+------+| ID | name | Addr | Num |+----+-------+------+------+| 1 | Chris | xxx | |+----+-------+------+------+1 row in Set (0.71 sec) memsql> select * from test_001;+----+-------+------+------+| ID | name | Addr | Num |+----+-------+------+------+| 1 | Chris | xxx | |+----+-------+------+------+1 row in Set (0.00 sec) memsql> SELECT * FROM test_001;+----+-------+------+------+| ID | name | Addr | Num |+----+-------+------+------+| 1 | Chris | xxx | |+----+-------+------+------+1 row in Set (0.00 sec) memsql> SELECT * from test_001;+----+-------+------+------+| ID | name | Addr | Num |+----+-------+------+------+| 1 | Chris | xxx | |+----+-------+------+------+1 row in Set (0.00 sec) memsql> Select COUNT (0) from test_001;+----------+| Count (0) |+----------+| 1 |+----------+1 row in Set (0.63 sec) memsql>memsql> Select COUNT (0) from test_001;+----------+| Count (0) |+----------+| 1 |+----------+1 row in Set (0.00 sec) memsql> Select COUNT (0) from test_001;+----------+| Count (0) |+----------+| 1 |+----------+1 row in Set (0.00 sec) query, the server will log: 136674795 2014-08-15 14:02:31 info:table chris001.test_001 Comp Iled in 6709 miliseconds (3185 miliseconds for header) 136678436 2014-08-15 14:02:31 info:table chris001.test_001 Row Size Bytes (base overhead bytes, column ID 4 bytes, columN Name bytes, column addr bytes, column num 8 bytes) 186966810 2012-06-19 10:03:21 info:query chris001. ' INSERT INTO test_001 values (?,?,?,?) ' compiled in 1825 miliseconds194366714 2012-06-19 10:03:29 info:query chris001. ' SELECT * FROM t est_001 ' compiled in 712 miliseconds283342115 2012-06-19 10:04:58 info:query chris001. ' Select COUNT (0) from test_001 ' com Piled in 632 miliseconds we see from the above test that the first and after time comparison of two queries: SELECT * from test_001; (0.71 sec) (0.00 sec) Select COUNT (0) from test_001; (0.63 sec) (0.00 sec) from the log it is known that the time-consuming of the first query is almost all spent on compilation.
Four, the application scenario
Memsql have very high insertion performance, so their target audience is those with frequent trading systems.