日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

@MySQL的存储引擎

發(fā)布時間:2023/12/10 数据库 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 @MySQL的存储引擎 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1.存儲引擎

查看MySQL提供了哪些存儲引擎

mysql> show engines; +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ | Engine | Support | Comment | Transactions | XA | Savepoints | +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO | | CSV | YES | CSV storage engine | NO | NO | NO | | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO | | BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO | | MyISAM | YES | MyISAM storage engine | NO | NO | NO | | FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL | | ARCHIVE | YES | Archive storage engine | NO | NO | NO | | InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES | | PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO | +--------------------+---------+----------------------------------------------------------------+--------------+------+------------+ 9 rows in set (0.00 sec)

查看MySQL當前默認的存儲引擎

mysql> show variables like '%storage_engine%'; +----------------------------+--------+ | Variable_name | Value | +----------------------------+--------+ | default_storage_engine | InnoDB | | default_tmp_storage_engine | InnoDB | | storage_engine(當前存儲引擎) | InnoDB | +----------------------------+--------+ 3 rows in set (0.00 sec)
對比項 MyISAM InnoDB
外鍵? ? ? ? 不支持   ? ? ? ? ? ? ? ? ? ? ? ? ? ?支持
事務不支持? ? ? ? ? ? ? ? ? ? ? ? ? ?支持
行表鎖

表鎖,即使操作一條記錄也會鎖住整張表,

不適合高并發(fā)的操作

行鎖,操作時只鎖定某一行,不對其他的行有影響,

適合高并發(fā)的操作

緩存只緩存索引,不緩存真實數(shù)據(jù)

不僅緩存索引還緩存真實數(shù)據(jù),對內(nèi)存要求較高,

而且內(nèi)存大小對性能有決定性影響

表空間? ? ? ? ? ? ? ? ? ? ? ? 小? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 大
關注點? ? ? ? ? ? ? ? ? ? ? 性能? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?事務

2.sql性能下降的原因

1).查詢語句寫的爛。

2).索引失效,可能常用的搜索字段沒有建索引。

3).關聯(lián)查詢太多的join。

4).MySQL服務器調(diào)優(yōu)及各個參數(shù)的設置(緩沖,線程數(shù)等)。

3.sql的執(zhí)行順序

手寫的sql

SELECT <select_list> FROM <left_table><join_type> JOIN <right_table> ON <join_condition> WHERE <where_condition> GROUP BY<group_by_list> HAVING<having_condition> ORDER BY<order_by_condition> LIMIT <limit_number>

MySQL是怎么讀的呢?(從from開始讀)

FROM <left_table> ON <join_condition> <join_type> JOIN <right_table> WHERE <where_condition> GROUP BY <group_by_list> HAVING <having_condition> SELECT <select_list> ORDER BY <order_by_condition> LIMIT <limit_number>

WHERE和GROUP BY是一對喲~

總結(jié)

以上是生活随笔為你收集整理的@MySQL的存储引擎的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。