Skip to content

Commit 263745e

Browse files
代码风水师代码风水师
authored andcommitted
更新了MySQL存储引擎对比
1 parent af43996 commit 263745e

3 files changed

Lines changed: 59 additions & 12 deletions

File tree

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1-
<h3 style="padding-bottom:6px; padding-left:20px; color:#ffffff; background-color:#E74C3C;">一、ArrayList</h3>
1+
<h3 style="padding-bottom:6px; padding-left:20px; color:#ffffff; background-color:#E74C3C;">MySQL存储引擎</h3>
2+
3+
4+
5+
存储引擎对比
6+
7+
| 引擎 | 存储限制 | 支持事务 | 全文索引 | 哈希索引 | 数据缓存 | 支持外键 |
8+
| ------- | -------- | :------: | :------: | :------: | :------: | :------: |
9+
| InnoDB | 64TB || :x: ||||
10+
| MyISAM | 256TB | :x: ||| :x: | :x: |
11+
| Memory | RAM | :x: | :x: || N/A | :x: |
12+
| Archive | None | :x: | :x: | :x: | :x: | :x: |
213

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Linux平台MySQL的有关目录:
2+
3+
| 目录 | 描述 |
4+
| ------------------ | -------------------------- |
5+
| /usr/bin | 客户端和脚本 |
6+
| /usr/sbin | MYSQLD服务器 |
7+
| /usr/lib/mysql ||
8+
| /usr/share/info | 信息格式的手册 |
9+
| /usr/share/man | UNIX帮助页 |
10+
| /usr/share/mysql | 错误消息、字符集、示例配置 |
11+
| /usr/include/mysql | 头文件 |
12+
| **/var/lib/mysql** | 日志文件和数据库 |
13+
14+
15+
16+
```shell
17+
# 关于MySQL启动与关闭服务的命令分别表示:启动、停止、重启、查看状态
18+
$ service mysqld start | stop | restart | status
19+
```
20+
21+
查看数据库的引擎情况:
22+
23+
```mysql
24+
SHOW ENGINES;
25+
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
26+
| Engine | Support | Comment | Transactions | XA | Savepoints |
27+
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
28+
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
29+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
30+
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
31+
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
32+
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
33+
| CSV | YES | CSV storage engine | NO | NO | NO |
34+
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
35+
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
36+
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
37+
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
38+
9 rows in set (0.00 sec)
39+
```
40+

resource/markdown/database/SQLOptimization.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,23 @@ EXPLAIN SELECT [字段...] FROM TABLE;
2525

2626
**重要字段说明**
2727

28-
select_type:
28+
select_type:使用的SELECT查询类型,比如SIMPLE、PRIMARY、UNION、SUBQUERY等;
2929

30-
table:关于哪张表的结果行
30+
table:关于访问哪张表,如果是多表,则按访问的先后顺序排列
3131

32-
partitions:
33-
34-
**type**:非常非常重要的指标,表示MySQL在表中找到行记录的方式,又称 **访问类型**。访问类型的性能指标从差到好依次是
32+
**type**:非常非常重要的指标,表示MySQL在表中找到行记录的方式,又称 **访问类型**。访问类型的性能指标从差到好依次是 system > const > eq_ref > ref > fulltext > ref_or_null > index_merge > unique_subquery > index_subquery > range > index > ALL,一般来说,得保证查询至少达到range级别,最好能达到ref,否则就可能会出现性能问题。;
3533

3634
**possible_keys**:可能用到的索引,如果为 *NULL*,表示没有可能用到的索引;
3735

3836
**key**:用到的索引,如果为 *NULL*,表示没有使用索引;
3937

40-
key_len:
41-
42-
ref:
38+
**key_len**:按字节计算的索引长度,值越小,表示越快;
4339

44-
rows:
40+
ref:关联关系中另一个表的列名称;
4541

46-
filtered:
42+
rows:查询数据返回的行数;
4743

48-
Extra:
44+
Extra:与关联操作有关的信息。
4945

5046

5147

0 commit comments

Comments
 (0)