More Related Content
Similar to [Java Küche RDB 最前線 2015] MySQL 5.7技術アップデート (20)
More from Ryusuke Kajiyama (13)
[Java Küche RDB 最前線 2015] MySQL 5.7技術アップデート
- 25. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
MySQL*Cluster*7.4*–*
NoSQL:*20 / & *
FlexAsych*(C++*NDB*API)
SQL:*250
/ & *
DBT2*BM
31
!"!!!!
!50,000,000!!
!100,000,000!!
!150,000,000!!
!200,000,000!!
!250,000,000!!
2! 4! 6! 8! 10! 12! 14! 16! 18! 20! 22! 24! 26! 28! 30! 32!
Reads&per&second&
Data&Nodes&
FlexAsync&Reads&
!"!!!!
!500,000!!
!1,000,000!!
!1,500,000!!
!2,000,000!!
!2,500,000!!
!3,000,000!!
2! 4! 6! 8! 10! 12! 14! 16!
SQL$Statements/sec$
Data$Nodes$
DBT2$SQL$Statements$per$Second$
- 32. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
CREATE TABLE t(c1 INT) engine=InnoDB;
FLUSH TABLE t FOR EXPORT; -- quiesce the table and create the meta data file
$innodb_data_home_dir/test/t.cfg
UNLOCK TABLES;
CREATE TABLE t(c1 INT) engine=InnoDB; -- if it doesn't already exist
ALTER TABLE t DISCARD TABLESPACE;
-- The user must stop all updates on the tables, prior to the IMPORT
ALTER TABLE t IMPORT TABLESPACE;
MySQL*5.6:*InnoDB
• MySQL *
– Export*
– Import
- 37. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
0&
100,000&
200,000&
300,000&
400,000&
500,000&
600,000&
700,000&
8& 16& 32& 64& 128& 256& 512& 1,024&
Queries&per&Second&
ConnecNons&
MySQL&5.7:&Sysbench&Read&Only&(Point&Select)&
MySQL&5.7&
MySQL&5.6&
MySQL&5.5&
MySQL*5.7:*Sysbench*Benchmark*
*
Intel(R)*Xeon(R)*CPU*E7`4860*x86_64*
4*sockets*x*10*cores`HT*(80*CPU*threads)*
2.3*GHz,*512*GB*RAM*
Oracle*Linux*6.5*
&&&&&&&&&&2x&Faster&than&MySQL&5.6&
& & & &3x&Faster&than&MySQL&5.5&
645,000&QPS&
43*
- 40. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
MySQL*5.7:*OpImizer*`*JSON*EXPLAIN *
• JSON*EXPLAIN *
– *
– MySQL*Workbench Visual*Explain *
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "200.40"
},
"table": {
"table_name": "nicer_but_slower_film_list",
"access_type": "ALL",
"rows_examined_per_scan": 992,
"rows_produced_per_join": 992,
"filtered": 100,
"cost_info": {
"read_cost": "2.00",
"eval_cost": "198.40",
"prefix_cost": "200.40",
"data_read_per_join": "852K"
},
"used_columns": [
"FID",
"title",
"description",
"category",
"price",
"length",
"rating",
"actors"
],
...
- 44. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
InnoDB*`*Full*Text*Search*(FTS)
• N`gram *
– *
• mecab *
–
51
CREATE TABLE `N_DEMO`(
`FTS_N_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(100) DEFAULT NULL,
PRIMARY KEY (`FTS_N_ID`),
FULLTEXT KEY `ngram_idx` (`title`) /*!50100 WITH PARSER `ngram` */
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
CREATE TABLE `M_DEMO` (
`FTS_M_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(100) DEFAULT NULL,
PRIMARY KEY (`FTS_M_ID`),
FULLTEXT KEY `mecab_idx` (`title`) /*!50100 WITH PARSER `mecab` */
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
- 52. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
MySQL*5.7:*スキーマ内マルチスレッドスレーブ*
• *
5 *
– *
– *
*
• GTID*&* *
*
• Sysbench*OLTP*test*
– 1,000
*
– SSD*/*48*core*HT*/*512*GB*RAM*
*
59*
0*
500*
1000*
1500*
2000*
2500*
3000*
3500*
4000*
4500*
5000*
0* 4* 16* 25* 50* 100* 200*
Worker&Threads&
Slave&TransacNons&per&Second&
Baseline*
50*clients*
100*clients*
150*clients*
200*clients*
88slave8parallel8type&
&
1.&DATABASE**:*(Default)*Use*the*db*parIIoned*MTS*(1*worker*per*database)*
2.&LOGICAL_CLOCK:**Use*logical*clock*based*parallelizaIon*mode.&
- 60. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
HTTP*Plugin*for*MySQL
The&SQL&endpoint&and&JSON&
68
shell> curl -X GET --user scott:tiger --url 'http://127.0.0.1:8080/sql/world/
SELECT+ID,Name+FROM+City+WHERE+Name=%27Tokyo%27'
[
{
"meta":[
{"type":,"catalog":"def","database":"world","table":"City","org_table":"ci
ty","column":"ID","org_column":"ID","charset":63,"length":11,"flags":
16899,"decimals":0},
{"type":
254,"catalog":"def","database":"world","table":"City","org_table":"city","column
":"Name","org_column":"Name","charset":33,"length":105,"flags":1,"decimals":0}
],
"data":[
["1532","Tokyo"]
],
"status":[{"server_status":34,"warning_count":0
}
]
- 63. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
MySQL*5.7:*JSON
71
mysql> CREATE TABLE employees (ename JSON);
Query OK, 0 rows affected (0,01 sec)
mysql> INSERT INTO employees VALUES ('{"id": 1, "name": "Jane"}');
Query OK, 1 row affected (0,00 sec)
mysql> INSERT INTO employees VALUES ('{"id": 2, "name": "Joe"}');
Query OK, 1 row affected (0,00 sec)
mysql> SELECT * FROM employees;
+---------------------------+
| ename|
+---------------------------+
| {"id": 1, "name": "Jane"} |
| {"id": 2, "name": "Joe"} |
+---------------------------+
2 rows in set (0,00 sec)
RC2*
- 66. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
• json_array()
– Build*a*JSON*array*from*list*of*expressions*
• json_object()
– Builds*JSON*objects*from*a*variable*length*list*
of*key/value*pairs*
• json_insert()
– Adds*'missing'*data*to*JSON*documents*
• json_remove()
– Removes*a^ributes*from*exisIng*JSON*
documents*
• json_set()
– Sets*a^ributes*within*JSON*documents*
• json_replace()
– Replaces*(but*doesn't*add)*a^ributes*within*
JSON*documents*
• json_append()
json_array_append()*(5.7.9+)*
– Adds*a*value*to*the*end*of*an*array*
• json_merge()
– Merges*two*arrays**
• json_extract()
– Returns*a*value*nested*inside*of*a*JSON*
document*
74*
JSON*FuncIons*for*CreaIng*&*ManipulaIng*
*JSON*Documents*
RC2*
- 67. Copyright*©*201 *Oracle*and/or*its*affiliates.*All*rights*reserved.**|*
• json_search()
– Search*for*values*within*JSON*documents*and*
return*their*locaIons*
• json_contains()
– Checks*for*a*specific*element*and*value*
• json_contains_path()
– Determine*if*a*specific*element*is*present*in*a*
document*in*a*specific*posiIon*
• json_valid()
– Check*if*document*is*a*valid*JSON*document*
• json_type()
– Find*the*type*of*a*value*within*a*document*
• json_keys()
– Returns*arrays*of*the*key*names*for*the*JSON*
documents*
• json_length()
– Number*of*elements*in*JSON*document*
• json_depth()
– Level*of*nesIng*in*JSON*document*
• json_unquote()
– Helps*move*from*JSON*to*other*MySQL*types*
• json_quote()
– Helps*move*from*other*MySQL*types*to*JSON*
75*
Query*and*Search*JSON*FuncIons*
RC2*