{"id":90767,"date":"2026-08-05T22:24:45","date_gmt":"2026-08-05T14:24:45","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/90767.html"},"modified":"2026-08-05T22:24:45","modified_gmt":"2026-08-05T14:24:45","slug":"mysql-8-0%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96%e7%bb%88%e6%9e%81%e6%8c%87%e5%8d%97%ef%bc%9a20%e6%9d%a1%e7%a1%ac%e6%a0%b8%e8%b0%83%e4%bc%98%e7%bb%8f%e9%aa%8c%ef%bc%882026%e6%9c%80%e6%96%b0%e7%89%88","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/90767.html","title":{"rendered":"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09"},"content":{"rendered":"<p style=\"margin-left:28.3500pt\"><span style=\"color:#666666\">MySQL\u6027\u80fd\u4f18\u5316\u662f\u540e\u7aef\u5f00\u53d1\u548cDBA\u7684\u5fc5\u4fee\u8bfe\u3002\u672c\u6587\u6574\u7406\u4e86\u7b14\u8005\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5b9e\u6218\u9a8c\u8bc1\u768420\u6761MySQL 8.0\u8c03\u4f18\u7ecf\u9a8c&#xff0c;\u6db5\u76d6\u7d22\u5f15\u4f18\u5316\u3001\u6162\u67e5\u8be2\u5206\u6790\u3001InnoDB\u53c2\u6570\u3001SQL\u4f18\u5316\u3001\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868\u5168\u94fe\u8def&#xff0c;\u6bcf\u6761\u90fd\u6709\u771f\u5b9e\u6848\u4f8b\u652f\u6491\u3002<\/span><\/p>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u4e00\u3001\u7d22\u5f15\u4f18\u5316&#xff1a;80%\u7684\u6027\u80fd\u95ee\u9898\u51fa\u5728\u8fd9\u91cc<\/span><\/span><\/h3>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">1.1 \u8986\u76d6\u7d22\u5f15&#xff1a;\u907f\u514d\u56de\u8868<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u5047\u8bbe\u6709\u4e00\u5f20\u7528\u6237\u8868<\/span><\/p>\n<p><span style=\"color:#333333\">CREATE TABLE users (<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0id BIGINT PRIMARY KEY AUTO_INCREMENT,<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0user_id VARCHAR(32) NOT NULL,<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0phone VARCHAR(20) NOT NULL,<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0nickname VARCHAR(64),<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0status TINYINT DEFAULT 1,<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0created_at DATETIME DEFAULT CURRENT_TIMESTAMP,<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0INDEX idx_user_id (user_id),<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0INDEX idx_phone (phone),<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0INDEX idx_status_created (status, created_at)<\/span><\/p>\n<p><span style=\"color:#333333\">) ENGINE&#061;InnoDB;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u274c \u6162\u67e5\u8be2&#xff1a;\u9700\u8981\u56de\u8868\u53d6nickname<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT id, user_id, phone, nickname FROM users WHERE user_id &#061; &#039;U10086&#039;;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u2705 \u4f18\u5316&#xff1a;\u5efa\u7acb\u8986\u76d6\u7d22\u5f15&#xff0c;\u76f4\u63a5\u4ece\u7d22\u5f15\u83b7\u53d6\u6570\u636e<\/span><\/p>\n<p><span style=\"color:#333333\">ALTER TABLE users ADD INDEX idx_uid_phone_nick (user_id, phone, nickname);<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT id, user_id, phone, nickname FROM users WHERE user_id &#061; &#039;U10086&#039;;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:28.3500pt\"><span style=\"color:#666666\">\u539f\u7406<\/span><span style=\"color:#666666\">&#xff1a;InnoDB\u7684\u4e8c\u7ea7\u7d22\u5f15\u53f6\u5b50\u8282\u70b9\u5b58\u50a8\u7684\u662f\u4e3b\u952e\u503c&#xff0c;\u67e5\u51fa\u4e3b\u952e\u540e\u8fd8\u8981\u56de\u8868\u5230\u805a\u7c07\u7d22\u5f15\u53d6\u5b8c\u6574\u884c\u3002\u5982\u679c\u67e5\u8be2\u5b57\u6bb5\u5168\u5728\u7d22\u5f15\u4e2d&#xff08;\u8986\u76d6\u7d22\u5f15&#xff09;&#xff0c;\u5c31\u7701\u53bb\u4e86\u56de\u8868\u64cd\u4f5c\u3002<\/span><\/p>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">1.2 \u8054\u5408\u7d22\u5f15\u4e0e\u6700\u5de6\u524d\u7f00\u539f\u5219<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u8054\u5408\u7d22\u5f15 (status, created_at, user_id)<\/span><\/p>\n<p><span style=\"color:#333333\">&#8212; \u4ee5\u4e0b\u67e5\u8be2\u80fd\u8d70\u7d22\u5f15&#xff1a;<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM users WHERE status &#061; 1; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8212; \u2705 \u547d\u4e2d<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM users WHERE status &#061; 1 AND created_at &gt; &#039;2026-01-01&#039;; \u00a0&#8212; \u2705 \u547d\u4e2d<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM users WHERE status &#061; 1 AND created_at &gt; &#039;2026-01-01&#039; AND user_id LIKE &#039;U%&#039;; \u00a0&#8212; \u2705 \u547d\u4e2d<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u4ee5\u4e0b\u67e5\u8be2\u4e0d\u80fd\u6709\u6548\u8d70\u7d22\u5f15&#xff1a;<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM users WHERE created_at &gt; &#039;2026-01-01&#039;; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8212; \u274c \u8df3\u8fc7\u4e86status<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM users WHERE user_id &#061; &#039;U10086&#039;; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8212; \u274c \u8df3\u8fc7\u4e86\u524d\u4e24\u5217<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">1.3 \u7d22\u5f15\u4f18\u5316\u901f\u67e5\u8868<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u573a\u666f<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u63a8\u8350\u7d22\u5f15\u7c7b\u578b<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u6ce8\u610f\u4e8b\u9879<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u7b49\u503c\u67e5\u8be2<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u666e\u901aB&#043;Tree\u7d22\u5f15<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u6700\u5e38\u7528<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u8303\u56f4\u67e5\u8be2<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u8054\u5408\u7d22\u5f15&#xff0c;\u8303\u56f4\u5217\u653e\u6700\u540e<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u8303\u56f4\u67e5\u8be2\u540e\u7684\u5217\u65e0\u6cd5\u8d70\u7d22\u5f15<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u6392\u5e8f<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u8986\u76d6\u7d22\u5f15\u5305\u542b\u6392\u5e8f\u5217<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u907f\u514dfilesort<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u6a21\u7cca\u67e5\u8be2<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u524d\u7f00\u5339\u914d\u53ef\u8d70\u7d22\u5f15<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>&#096;LIKE &#039;abc%&#039;&#096;\u53ef\u4ee5&#xff0c;&#096;LIKE &#039;%abc&#039;&#096;\u4e0d\u884c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u53bb\u91cd\u7edf\u8ba1<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u524d\u7f00\u7d22\u5f15<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>&#096;COUNT(DISTINCT LEFT(col, 10))&#096;\u8bc4\u4f30\u524d\u7f00\u957f\u5ea6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>JSON\u67e5\u8be2<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u51fd\u6570\u7d22\u5f15<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>MySQL 8.0&#043;\u652f\u6301<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u4e8c\u3001\u6162\u67e5\u8be2\u5206\u6790&#xff1a;\u7528EXPLAIN\u770b\u900f\u6267\u884c\u8ba1\u5212<\/span><\/span><\/h3>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">2.1 EXPLAIN\u5173\u952e\u5b57\u6bb5\u89e3\u8bfb<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">EXPLAIN SELECT u.nickname, o.order_no, o.amount<\/span><\/p>\n<p><span style=\"color:#333333\">FROM users u<\/span><\/p>\n<p><span style=\"color:#333333\">JOIN orders o ON u.id &#061; o.user_id<\/span><\/p>\n<p><span style=\"color:#333333\">WHERE u.status &#061; 1 AND o.created_at &gt; &#039;2026-01-01&#039;<\/span><\/p>\n<p><span style=\"color:#333333\">ORDER BY o.amount DESC<\/span><\/p>\n<p><span style=\"color:#333333\">LIMIT 20;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u5b57\u6bb5<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u542b\u4e49<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u5173\u6ce8\u70b9<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>type<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u8bbf\u95ee\u7c7b\u578b<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u81f3\u5c11\u8fbe\u5230range&#xff0c;\u6700\u597dconst\/ref<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>key<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u5b9e\u9645\u4f7f\u7528\u7684\u7d22\u5f15<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u4e3aNULL\u8bf4\u660e\u6ca1\u8d70\u7d22\u5f15<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>rows<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u9884\u4f30\u626b\u63cf\u884c\u6570<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u8d8a\u5c0f\u8d8a\u597d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>filtered<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u8fc7\u6ee4\u6bd4\u4f8b<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u4f4e\u4e8e10%\u8bf4\u660e\u7d22\u5f15\u9009\u62e9\u4e0d\u4f73<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>Extra<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u989d\u5916\u4fe1\u606f<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u51fa\u73b0Using filesort\/Using temporary\u8981\u4f18\u5316<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">2.2 type\u5b57\u6bb5\u7b49\u7ea7\u5bf9\u7167<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">\u6027\u80fd\u4ece\u597d\u5230\u5dee&#xff1a;<\/span><\/p>\n<p><span style=\"color:#333333\">const &gt; eq_ref &gt; ref &gt; range &gt; index &gt; ALL<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500 \u5168\u8868\u626b\u63cf&#xff08;\u5fc5\u987b\u4f18\u5316&#xff09;<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500 \u5168\u7d22\u5f15\u626b\u63cf<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500 \u8303\u56f4\u626b\u63cf<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500 \u975e\u552f\u4e00\u7d22\u5f15\u7b49\u503c\u67e5\u627e<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500 \u552f\u4e00\u7d22\u5f15\u7b49\u503c\u5173\u8054<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u2514\u2500 \u4e3b\u952e\/\u552f\u4e00\u7d22\u5f15\u7b49\u503c\u67e5\u8be2<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">2.3 \u5f00\u542f\u6162\u67e5\u8be2\u65e5\u5fd7<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u67e5\u770b\u6162\u67e5\u8be2\u914d\u7f6e<\/span><\/p>\n<p><span style=\"color:#333333\">SHOW VARIABLES LIKE &#039;slow_query%&#039;;<\/span><\/p>\n<p><span style=\"color:#333333\">SHOW VARIABLES LIKE &#039;long_query_time&#039;;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u52a8\u6001\u5f00\u542f\u6162\u67e5\u8be2\u65e5\u5fd7<\/span><\/p>\n<p><span style=\"color:#333333\">SET GLOBAL slow_query_log &#061; &#039;ON&#039;;<\/span><\/p>\n<p><span style=\"color:#333333\">SET GLOBAL long_query_time &#061; 1; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8212; \u8d85\u8fc71\u79d2\u8bb0\u5f55<\/span><\/p>\n<p><span style=\"color:#333333\">SET GLOBAL slow_query_log_file &#061; &#039;\/var\/log\/mysql\/slow.log&#039;;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u8bb0\u5f55\u672a\u8d70\u7d22\u5f15\u7684\u67e5\u8be2<\/span><\/p>\n<p><span style=\"color:#333333\">SET GLOBAL log_queries_not_using_indexes &#061; &#039;ON&#039;;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\"># \u4f7f\u7528mysqldumpslow\u5206\u6790\u6162\u67e5\u8be2<\/span><\/p>\n<p><span style=\"color:#333333\">mysqldumpslow -s t -t 10 \/var\/log\/mysql\/slow.log<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># \u53c2\u6570\u8bf4\u660e&#xff1a;<\/span><\/p>\n<p><span style=\"color:#333333\"># -s t \u00a0\u6309\u603b\u8017\u65f6\u6392\u5e8f<\/span><\/p>\n<p><span style=\"color:#333333\"># -s l \u00a0\u6309\u9501\u5b9a\u65f6\u95f4\u6392\u5e8f<\/span><\/p>\n<p><span style=\"color:#333333\"># -s r \u00a0\u6309\u8fd4\u56de\u884c\u6570\u6392\u5e8f<\/span><\/p>\n<p><span style=\"color:#333333\"># -t 10 \u53ea\u663e\u793a\u524d10\u6761<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u4e09\u3001InnoDB\u53c2\u6570\u8c03\u4f18<\/span><\/span><\/h3>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">3.1 \u6838\u5fc3\u53c2\u6570\u914d\u7f6e<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\"># my.cnf \u6838\u5fc3\u8c03\u4f18\u914d\u7f6e<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">[mysqld]<\/span><\/p>\n<p><span style=\"color:#333333\"># &#061;&#061;&#061;&#061;&#061; \u5185\u5b58\u76f8\u5173 &#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span style=\"color:#333333\"># \u7f13\u51b2\u6c60\u5927\u5c0f&#xff0c;\u901a\u5e38\u8bbe\u4e3a\u7269\u7406\u5185\u5b58\u768460-70%<\/span><\/p>\n<p><span style=\"color:#333333\">innodb_buffer_pool_size &#061; 8G<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># MySQL 8.0\u53ef\u4ee5\u8bbe\u7f6e\u591a\u4e2a\u7f13\u51b2\u6c60\u5b9e\u4f8b&#xff0c;\u51cf\u5c11\u9501\u7ade\u4e89<\/span><\/p>\n<p><span style=\"color:#333333\">innodb_buffer_pool_instances &#061; 8<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># &#061;&#061;&#061;&#061;&#061; \u65e5\u5fd7\u76f8\u5173 &#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span style=\"color:#333333\"># Redo Log\u5927\u5c0f&#xff0c;\u5199\u5165\u5bc6\u96c6\u573a\u666f\u5efa\u8bae\u8c03\u5927<\/span><\/p>\n<p><span style=\"color:#333333\">innodb_redo_log_capacity &#061; 4G<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># Binlog\u914d\u7f6e<\/span><\/p>\n<p><span style=\"color:#333333\">binlog_format &#061; ROW<\/span><\/p>\n<p><span style=\"color:#333333\">binlog_row_image &#061; MINIMAL<\/span><\/p>\n<p><span style=\"color:#333333\">expire_logs_days &#061; 7<\/span><\/p>\n<p><span style=\"color:#333333\">sync_binlog &#061; 1000<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># &#061;&#061;&#061;&#061;&#061; IO\u76f8\u5173 &#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span style=\"color:#333333\"># \u5237\u810f\u9875\u7b56\u7565&#xff0c;0&#061;\u4f9d\u8d56OS, 1&#061;\u6bcf\u6b21\u63d0\u4ea4\u5237\u76d8, 2&#061;\u6bcf\u6b21\u63d0\u4ea4\u5199OS buffer<\/span><\/p>\n<p><span style=\"color:#333333\">innodb_flush_log_at_trx_commit &#061; 1<\/span><\/p>\n<p><span style=\"color:#333333\">innodb_flush_method &#061; O_DIRECT<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># \u5e76\u53d1\u76f8\u5173<\/span><\/p>\n<p><span style=\"color:#333333\">innodb_io_capacity &#061; 2000<\/span><\/p>\n<p><span style=\"color:#333333\">innodb_io_capacity_max &#061; 4000<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># &#061;&#061;&#061;&#061;&#061; \u8fde\u63a5\u76f8\u5173 &#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span style=\"color:#333333\">max_connections &#061; 500<\/span><\/p>\n<p><span style=\"color:#333333\">wait_timeout &#061; 28800<\/span><\/p>\n<p><span style=\"color:#333333\">interactive_timeout &#061; 28800<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># &#061;&#061;&#061;&#061;&#061; \u4e34\u65f6\u8868 &#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span style=\"color:#333333\">tmp_table_size &#061; 256M<\/span><\/p>\n<p><span style=\"color:#333333\">max_heap_table_size &#061; 256M<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># &#061;&#061;&#061;&#061;&#061; \u6392\u5e8f &#061;&#061;&#061;&#061;&#061;<\/span><\/p>\n<p><span style=\"color:#333333\">sort_buffer_size &#061; 4M<\/span><\/p>\n<p><span style=\"color:#333333\">join_buffer_size &#061; 4M<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">3.2 \u53c2\u6570\u8c03\u4f18\u5bf9\u7167\u8868<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u53c2\u6570<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u9ed8\u8ba4\u503c<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u63a8\u8350\u503c&#xff08;16G\u5185\u5b58&#xff09;<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u8bf4\u660e<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>innodb_buffer_pool_size<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>128M<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>10G<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u7f13\u5b58\u6570\u636e\u548c\u7d22\u5f15&#xff0c;\u6700\u91cd\u8981<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>innodb_buffer_pool_instances<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>1<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>8<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u51cf\u5c11\u7f13\u51b2\u6c60\u9501\u7ade\u4e89<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>innodb_redo_log_capacity<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>100MB<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>4G<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u5f71\u54cd\u5199\u5165\u6027\u80fd\u548c\u5d29\u6e83\u6062\u590d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>innodb_io_capacity<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>200<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>2000<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>SSD\u53ef\u8c03\u9ad8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>max_connections<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>151<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>500<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u6839\u636e\u4e1a\u52a1\u5e76\u53d1\u8c03\u6574<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>tmp_table_size<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>16M<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>256M<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u4e34\u65f6\u8868\u5185\u5b58\u5927\u5c0f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>sort_buffer_size<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>256K<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>4M<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u6392\u5e8f\u7f13\u51b2\u533a<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:28.3500pt\"><span style=\"color:#666666\">\u6ce8\u610f<\/span><span style=\"color:#666666\">&#xff1a;sort_buffer_size \u548c join_buffer_size \u662f<\/span><span style=\"color:#666666\">\u6bcf\u8fde\u63a5<\/span><span style=\"color:#666666\">\u5206\u914d\u7684&#xff0c;\u4e0d\u8981\u8bbe\u592a\u5927&#xff0c;\u5426\u5219\u9ad8\u5e76\u53d1\u65f6\u5185\u5b58\u4f1a\u7206\u3002<\/span><\/p>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u56db\u3001SQL\u8bed\u53e5\u4f18\u5316\u6280\u5de7<\/span><\/span><\/h3>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">4.1 \u6279\u91cf\u64cd\u4f5c\u4ee3\u66ff\u5faa\u73af\u5355\u6761<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\"># \u274c \u6162&#xff1a;\u5faa\u73af\u63d2\u51651000\u6761<\/span><\/p>\n<p><span style=\"color:#333333\">for user in user_list:<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0cursor.execute(&#034;INSERT INTO users (user_id, phone) VALUES (%s, %s)&#034;, (user[&#039;id&#039;], user[&#039;phone&#039;]))<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\"># \u2705 \u5feb&#xff1a;\u6279\u91cf\u63d2\u5165<\/span><\/p>\n<p><span style=\"color:#333333\">values &#061; [(u[&#039;id&#039;], u[&#039;phone&#039;]) for u in user_list]<\/span><\/p>\n<p><span style=\"color:#333333\">cursor.executemany(&#034;INSERT INTO users (user_id, phone) VALUES (%s, %s)&#034;, values)<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">4.2 \u907f\u514dSELECT *<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u274c \u4f20\u8f93\u4e0d\u5fc5\u8981\u7684\u5217&#xff0c;\u65e0\u6cd5\u5229\u7528\u8986\u76d6\u7d22\u5f15<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM orders WHERE user_id &#061; 10086;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u2705 \u53ea\u67e5\u9700\u8981\u7684\u5217<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT order_no, amount, status FROM orders WHERE user_id &#061; 10086;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">4.3 \u5206\u9875\u4f18\u5316<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u274c \u6df1\u5ea6\u5206\u9875&#xff0c;\u8d8a\u5f80\u540e\u8d8a\u6162&#xff08;LIMIT 1000000, 20&#xff09;<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM orders ORDER BY id LIMIT 1000000, 20;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u2705 \u65b9\u68481&#xff1a;\u6e38\u6807\u5206\u9875&#xff08;\u63a8\u8350&#xff09;<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM orders WHERE id &gt; 1000000 ORDER BY id LIMIT 20;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u2705 \u65b9\u68482&#xff1a;\u5ef6\u8fdf\u5173\u8054<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT o.* FROM orders o<\/span><\/p>\n<p><span style=\"color:#333333\">INNER JOIN (SELECT id FROM orders ORDER BY id LIMIT 1000000, 20) t<\/span><\/p>\n<p><span style=\"color:#333333\">ON o.id &#061; t.id;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">4.4 \u5e38\u89c1SQL\u53cd\u6a21\u5f0f\u4e0e\u6b63\u89e3<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u53cd\u6a21\u5f0f<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u95ee\u9898<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u6b63\u89e3<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>&#096;WHERE YEAR(created_at) &#061; 2026&#096;<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u51fd\u6570\u5bfc\u81f4\u7d22\u5f15\u5931\u6548<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>&#096;WHERE created_at &gt;&#061; &#039;2026-01-01&#039; AND created_at &lt; &#039;2027-01-01&#039;&#096;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>&#096;WHERE col IS NOT NULL&#096;<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u53ef\u80fd\u4e0d\u8d70\u7d22\u5f15<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u5efa\u7acbIS NULL\u4f18\u5316\u7d22\u5f15\u6216\u7528\u9ed8\u8ba4\u503c\u66ff\u4ee3NULL<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>&#096;OR&#096;\u8fde\u63a5\u4e0d\u540c\u5b57\u6bb5<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u53ef\u80fd\u5bfc\u81f4\u5168\u8868\u626b\u63cf<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u7528&#096;UNION ALL&#096;\u62c6\u5206<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>&#096;ORDER BY RAND()&#096;<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u968f\u673a\u6392\u5e8f\u5168\u8868\u626b\u63cf<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u9884\u751f\u6210\u968f\u673aID\u518d\u67e5\u8be2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>&#096;COUNT(*)&#096;\u5927\u8868<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u6162<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u7ef4\u62a4\u8ba1\u6570\u5668\u8868\u6216\u4f7f\u7528\u4f30\u7b97<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u4e94\u3001\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868<\/span><\/span><\/h3>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">5.1 \u8bfb\u5199\u5206\u79bb\u67b6\u6784<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u5e94\u7528\u670d\u52a1\u5c42 \u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0(\u8bfb\u5199\u8bf7\u6c42\u5206\u79bb) \u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25bc\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u00a0\u00a0\u00a0\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25bc\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u4e3b\u5e93 (\u5199) \u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u4ece\u5e93 (\u8bfb) \u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0MySQL Master \u00a0\u00a0\u2502\u2500\u2500\u2500\u25b6\u2502 \u00a0MySQL Slave \u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u590d\u5236 \u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u00a0\u00a0\u00a0\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25bc\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u00a0\u00a0\u00a0\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u25bc\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u4ece\u5e932 (\u8bfb) \u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u2502 \u00a0\u4ece\u5e933 (\u8bfb) \u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0MySQL Slave2 \u00a0\u2502 \u00a0\u00a0\u00a0\u2502 \u00a0MySQL Slave3 \u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u00a0\u00a0\u00a0\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">5.2 \u5206\u5e93\u5206\u8868\u7b56\u7565\u9009\u62e9<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u7b56\u7565<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u9002\u7528\u573a\u666f<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u4f18\u70b9<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:113.3000pt\">\n<p><span style=\"color:#ffffff\">\u7f3a\u70b9<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u5782\u76f4\u5206\u5e93<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u6309\u4e1a\u52a1\u62c6\u5206<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u804c\u8d23\u6e05\u6670<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u4e0d\u80fd\u89e3\u51b3\u5355\u8868\u6570\u636e\u91cf\u5927\u7684\u95ee\u9898<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u5782\u76f4\u5206\u8868<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u5927\u5b57\u6bb5\u62c6\u5206<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u51cf\u5c11IO<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u8de8\u8868\u67e5\u8be2\u9700\u8981JOIN<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u6c34\u5e73\u5206\u8868<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u5355\u8868\u8d85\u5343\u4e07\u884c<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u5206\u6563\u538b\u529b<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:113.3000pt\">\n<p>\u8de8\u5206\u7247\u67e5\u8be2\u590d\u6742<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u6c34\u5e73\u5206\u5e93&#043;\u5206\u8868<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u5355\u5e93\u5355\u8868\u90fd\u74f6\u9888<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u6700\u5927\u6269\u5c55\u6027<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:113.3000pt\">\n<p>\u8fd0\u7ef4\u590d\u6742\u5ea6\u6700\u9ad8<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">5.3 \u5206\u7247\u952e\u9009\u62e9\u5efa\u8bae<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">\/\/ ShardingSphere \u5206\u5e93\u5206\u8868\u914d\u7f6e\u793a\u4f8b&#xff08;Java&#xff09;<\/span><\/p>\n<p><span style=\"color:#333333\">\/\/ \u6309user_id\u53d6\u6a21\u5206\u8868<\/span><\/p>\n<p><span style=\"color:#333333\">\/\/ user_id % 4 &#061; 0 \u2192 user_0<\/span><\/p>\n<p><span style=\"color:#333333\">\/\/ user_id % 4 &#061; 1 \u2192 user_1<\/span><\/p>\n<p><span style=\"color:#333333\">\/\/ &#8230;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">\/\/ \u5206\u7247\u89c4\u5219\u914d\u7f6e<\/span><\/p>\n<p><span style=\"color:#333333\">\/\/ \u5b9e\u9645\u914d\u7f6e\u4ee5ShardingSphere\u5b98\u65b9\u6587\u6863\u4e3a\u51c6<\/span><\/p>\n<p><span style=\"color:#333333\">\/\/ \u5173\u952e\u70b9&#xff1a;\u5206\u7247\u952e\u8981\u80fd\u8986\u76d680%\u4ee5\u4e0a\u7684\u67e5\u8be2\u6761\u4ef6<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u5206\u7247\u952e\u9009\u62e9\u8bc4\u4f30<\/span><\/p>\n<p><span style=\"color:#333333\">&#8212; 1. \u7edf\u8ba1\u9ad8\u9891\u67e5\u8be2\u7684WHERE\u6761\u4ef6<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT argument, count<\/span><\/p>\n<p><span style=\"color:#333333\">FROM performance_schema.events_statements_summary_by_digest<\/span><\/p>\n<p><span style=\"color:#333333\">ORDER BY count DESC LIMIT 20;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; 2. \u9009\u62e9\u51fa\u73b0\u9891\u7387\u6700\u9ad8\u7684\u5b57\u6bb5\u4f5c\u4e3a\u5206\u7247\u952e<\/span><\/p>\n<p><span style=\"color:#333333\">&#8212; \u901a\u5e38user_id\u662f\u6700\u5e38\u89c1\u7684\u5206\u7247\u952e\u9009\u62e9<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">5.4 \u5206\u5e93\u5206\u8868\u540e\u7684\u96be\u9898\u4e0e\u65b9\u6848<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<\/span><\/p>\n<p><span style=\"color:#333333\">\u2502 \u00a0\u00a0\u00a0\u00a0\u96be\u9898 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u89e3\u51b3\u65b9\u6848 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<\/span><\/p>\n<p><span style=\"color:#333333\">\u2502 \u8de8\u5206\u7247\u67e5\u8be2 \u00a0\u00a0\u00a0\u00a0\u2502 1. \u5197\u4f59\u5b57\u6bb5 2. \u5f02\u6b65\u540c\u6b65 3. \u9650\u5236\u8de8\u7247\u67e5\u8be2 \u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u2502 \u8de8\u5206\u7247JOIN \u00a0\u00a0\u00a0\u00a0\u2502 1. \u5e7f\u64ad\u8868 2. \u7ed1\u5b9a\u8868 3. \u5e94\u7528\u5c42\u7ec4\u88c5 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u2502 \u5206\u5e03\u5f0f\u4e8b\u52a1 \u00a0\u00a0\u00a0\u00a0\u2502 1. Seata AT\u6a21\u5f0f 2. TCC 3. \u6700\u7ec8\u4e00\u81f4\u6027(\u6d88\u606f\u8868) \u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u2502 \u5168\u5c40\u552f\u4e00ID \u00a0\u00a0\u00a0\u00a0\u2502 1. \u96ea\u82b1\u7b97\u6cd5 2. \u53f7\u6bb5\u6a21\u5f0f 3. UUID \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u2502 \u5206\u9875\u6392\u5e8f \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 1. \u5404\u5206\u7247\u67e5\u8be2\u540e\u5408\u5e76 2. \u7981\u6b62\u6df1\u5ea6\u8df3\u9875 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u2502 \u6570\u636e\u8fc1\u79fb \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502 1. \u53cc\u5199\u7070\u5ea6 2. \u5f71\u5b50\u8868 3. \u5728\u7ebfDDL\u5de5\u5177 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2502<\/span><\/p>\n<p><span style=\"color:#333333\">\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u516d\u3001MySQL 8.0\u65b0\u7279\u6027\u5229\u7528<\/span><\/span><\/h3>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">6.1 \u9690\u85cf\u7d22\u5f15&#xff08;Invisible Index&#xff09;<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u4e0a\u7ebf\u65b0\u7d22\u5f15\u524d\u5148\u8bbe\u4e3a\u9690\u85cf&#xff0c;\u89c2\u5bdf\u65e0\u5f71\u54cd\u540e\u518d\u6b63\u5f0f\u542f\u7528<\/span><\/p>\n<p><span style=\"color:#333333\">ALTER TABLE orders ADD INDEX idx_test (user_id, status) INVISIBLE;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u786e\u8ba4\u65e0\u5f71\u54cd\u540e\u8bbe\u4e3a\u53ef\u89c1<\/span><\/p>\n<p><span style=\"color:#333333\">ALTER TABLE orders ALTER INDEX idx_test VISIBLE;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u5982\u6709\u8d1f\u9762\u5f71\u54cd&#xff0c;\u76f4\u63a5\u5220\u9664<\/span><\/p>\n<p><span style=\"color:#333333\">ALTER TABLE orders DROP INDEX idx_test;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">6.2 \u964d\u5e8f\u7d22\u5f15<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; MySQL 8.0\u771f\u6b63\u652f\u6301\u964d\u5e8f\u7d22\u5f15&#xff08;8.0\u4e4b\u524d\u53ea\u662f\u8bed\u6cd5\u652f\u6301&#xff09;<\/span><\/p>\n<p><span style=\"color:#333333\">CREATE INDEX idx_desc ON orders (user_id, created_at DESC);<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u67e5\u8be2\u65f6\u5339\u914d\u964d\u5e8f&#xff0c;\u907f\u514dfilesort<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM orders WHERE user_id &#061; 10086 ORDER BY created_at DESC LIMIT 10;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">6.3 \u76f4\u65b9\u56fe\u7edf\u8ba1<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u5bf9\u6ca1\u6709\u7d22\u5f15\u7684\u5217\u521b\u5efa\u76f4\u65b9\u56fe&#xff0c;\u5e2e\u52a9\u4f18\u5316\u5668\u9009\u62e9\u66f4\u597d\u7684\u6267\u884c\u8ba1\u5212<\/span><\/p>\n<p><span style=\"color:#333333\">ANALYZE TABLE orders UPDATE HISTOGRAM ON status WITH 100 BUCKETS;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u67e5\u770b\u76f4\u65b9\u56fe<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT * FROM information_schema.column_statistics WHERE table_name &#061; &#039;orders&#039;;<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u4e03\u3001\u76d1\u63a7\u4e0e\u8fd0\u7ef4<\/span><\/span><\/h3>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">7.1 \u5173\u952e\u76d1\u63a7\u6307\u6807<\/span><\/span><\/h4>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#f5f5f5;width:453.3000pt\">\n<p><span style=\"color:#333333\">&#8212; \u5f53\u524d\u8fde\u63a5\u6570<\/span><\/p>\n<p><span style=\"color:#333333\">SHOW STATUS LIKE &#039;Threads_connected&#039;;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u7f13\u51b2\u6c60\u547d\u4e2d\u7387&#xff08;\u5e94 &gt; 99%&#xff09;<\/span><\/p>\n<p><span style=\"color:#333333\">SELECT <\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0(1 &#8211; (Innodb_buffer_pool_reads \/ Innodb_buffer_pool_read_requests)) * 100 AS hit_rate<\/span><\/p>\n<p><span style=\"color:#333333\">FROM (SELECT <\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0VARIABLE_VALUE AS Innodb_buffer_pool_reads <\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0FROM performance_schema.global_status <\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WHERE VARIABLE_NAME &#061; &#039;Innodb_buffer_pool_reads&#039;) a,<\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0(SELECT <\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0VARIABLE_VALUE AS Innodb_buffer_pool_read_requests <\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0FROM performance_schema.global_status <\/span><\/p>\n<p><span style=\"color:#333333\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0WHERE VARIABLE_NAME &#061; &#039;Innodb_buffer_pool_read_requests&#039;) b;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u6162\u67e5\u8be2\u6570\u91cf<\/span><\/p>\n<p><span style=\"color:#333333\">SHOW STATUS LIKE &#039;Slow_queries&#039;;<\/span><\/p>\n<\/p>\n<p><span style=\"color:#333333\">&#8212; \u6b7b\u9501\u4fe1\u606f<\/span><\/p>\n<p><span style=\"color:#333333\">SHOW ENGINE INNODB STATUS\\\\G<\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span style=\"color:#4f81bd\"><span style=\"color:#333333\">7.2 \u8fd0\u7ef4\u5efa\u8bae<\/span><\/span><\/h4>\n<p>\u5728\u751f\u4ea7\u73af\u5883\u4e2d&#xff0c;\u5982\u679c\u56e2\u961f\u8fd0\u7ef4\u4eba\u529b\u6709\u9650&#xff0c;\u81ea\u5efaMySQL\u4e3b\u4ece\u3001\u5907\u4efd\u3001\u76d1\u63a7\u662f\u4e00\u7b14\u4e0d\u5c0f\u7684\u6210\u672c\u3002\u7b14\u8005\u6240\u5728\u56e2\u961f\u5728\u4e1a\u52a1\u89c4\u6a21\u4e0a\u6765\u540e&#xff0c;\u9010\u6b65\u5c06MySQL\u8fc1\u79fb\u5230\u4e86[XX\u4e91]\u4e91\u6570\u636e\u5e93\u3002\u4e91\u6570\u636e\u5e93\u81ea\u5e26\u4e3b\u4ece\u9ad8\u53ef\u7528\u3001\u81ea\u52a8\u5907\u4efd\u3001\u6162\u67e5\u8be2\u5206\u6790\u7b49\u529f\u80fd&#xff0c;\u8fd8\u6709\u6027\u80fd\u6d1e\u5bdf\u548cSQL\u4f18\u5316\u5efa\u8bae&#xff0c;\u5bf9\u4e8e\u4e2d\u5c0f\u56e2\u961f\u6765\u8bf4\u6027\u4ef7\u6bd4\u5f88\u9ad8\u3002\u6838\u5fc3\u4ea4\u6613\u5e93\u53ef\u4ee5\u9009\u9ad8\u53ef\u7528\u7248&#xff0c;\u8bfb\u5199\u5206\u79bb\u7684\u4ece\u5e93\u53ef\u4ee5\u5f39\u6027\u589e\u51cf&#xff0c;\u5927\u4fc3\u65f6\u4e34\u65f6\u52a0\u4ece\u5e93\u5e94\u5bf9\u8bfb\u6d41\u91cf\u9ad8\u5cf0\u3002<\/p>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u516b\u300120\u6761\u8c03\u4f18\u7ecf\u9a8c\u901f\u67e5\u603b\u7ed3<\/span><\/span><\/h3>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u5e8f\u53f7<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u7ecf\u9a8c<\/span><\/p>\n<\/td>\n<td style=\"background-color:#2b579a;width:151.1000pt\">\n<p><span style=\"color:#ffffff\">\u4f18\u5148\u7ea7<\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>1<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u8986\u76d6\u7d22\u5f15\u907f\u514d\u56de\u8868<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>2<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u8054\u5408\u7d22\u5f15\u9075\u5faa\u6700\u5de6\u524d\u7f00<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>3<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>EXPLAIN\u5206\u6790\u6267\u884c\u8ba1\u5212<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>4<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>innodb_buffer_pool_size\u8bbe\u4e3a\u5185\u5b5860-70%<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>5<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u5f00\u542f\u6162\u67e5\u8be2\u65e5\u5fd7<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>6<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u907f\u514dSELECT *<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>7<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u6279\u91cf\u64cd\u4f5c\u4ee3\u66ff\u5faa\u73af\u5355\u6761<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>8<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u6df1\u5ea6\u5206\u9875\u7528\u6e38\u6807\u5206\u9875<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>9<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u51fd\u6570\u64cd\u4f5c\u5bfc\u81f4\u7d22\u5f15\u5931\u6548\u8981\u907f\u514d<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>10<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>innodb_redo_log_capacity\u8c03\u5927<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2605\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>11<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>sync_binlog\u548cflush_log_at_trx_commit\u6743\u8861<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>12<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>sort_buffer_size\u4e0d\u8981\u8bbe\u592a\u5927<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>13<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u8bfb\u5199\u5206\u79bb\u5206\u6563\u8bfb\u538b\u529b<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>14<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u5355\u8868\u8d85\u5343\u4e07\u8003\u8651\u5206\u8868<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>15<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u5229\u7528\u9690\u85cf\u7d22\u5f15\u7070\u5ea6\u4e0a\u7ebf<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2605\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>16<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u964d\u5e8f\u7d22\u5f15\u4f18\u5316\u6392\u5e8f<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2606\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>17<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u76f4\u65b9\u56fe\u8f85\u52a9\u4f18\u5316\u5668<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2606\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>18<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u5b9a\u671fANALYZE TABLE\u66f4\u65b0\u7edf\u8ba1\u4fe1\u606f<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2606\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>19<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u76d1\u63a7\u7f13\u51b2\u6c60\u547d\u4e2d\u7387<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:151.1000pt\">\n<p>\u2605\u2605\u2606\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>20<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u6b7b\u9501\u65e5\u5fd7\u5b9a\u671f\u6392\u67e5<\/p>\n<\/td>\n<td style=\"background-color:#edf2f7;width:151.1000pt\">\n<p>\u2605\u2605\u2606\u2606\u2606<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span style=\"color:#4f81bd\"><span style=\"color:#2b579a\">\u5199\u5728\u6700\u540e<\/span><\/span><\/h3>\n<p>MySQL\u6027\u80fd\u4f18\u5316\u662f\u4e00\u4e2a\u7cfb\u7edf\u5de5\u7a0b&#xff0c;\u4e0d\u662f\u8c03\u51e0\u4e2a\u53c2\u6570\u5c31\u80fd\u89e3\u51b3\u7684\u3002\u6838\u5fc3\u601d\u8def\u662f&#xff1a;\u5148\u5b9a\u4f4d\u95ee\u9898&#xff08;\u6162\u67e5\u8be2\u65e5\u5fd7&#043;EXPLAIN&#xff09;&#xff0c;\u518d\u9488\u5bf9\u6027\u4f18\u5316&#xff08;\u7d22\u5f15&#043;SQL&#043;\u53c2\u6570&#xff09;&#xff0c;\u6700\u540e\u505a\u67b6\u6784\u5c42\u9762\u7684\u6269\u5c55&#xff08;\u8bfb\u5199\u5206\u79bb&#043;\u5206\u5e93\u5206\u8868&#xff09;\u3002<\/p>\n<p>\u7d22\u5f15\u4f18\u5316\u80fd\u89e3\u51b380%\u7684\u95ee\u9898&#xff0c;InnoDB\u53c2\u6570\u8c03\u4f18\u80fd\u518d\u89e3\u51b315%&#xff0c;\u5269\u4e0b\u76845%\u624d\u9700\u8981\u5206\u5e93\u5206\u8868\u3002\u4e0d\u8981\u4e00\u4e0a\u6765\u5c31\u5206\u5e93\u5206\u8868&#xff0c;\u90a3\u662f\u6700\u540e\u7684\u624b\u6bb5\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u7b14\u8005\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u9a8c\u8bc1\u8fc7\u768420\u6761\u8c03\u4f18\u7ecf\u9a8c&#xff0c;\u6709\u95ee\u9898\u6b22\u8fce\u8bc4\u8bba\u533a\u4ea4\u6d41&#xff0c;\u770b\u5230\u4f1a\u56de\u590d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL\u6027\u80fd\u4f18\u5316\u662f\u540e\u7aef\u5f00\u53d1\u548cDBA\u7684\u5fc5\u4fee\u8bfe\u3002\u672c\u6587\u6574\u7406\u4e86\u7b14\u8005\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5b9e\u6218\u9a8c\u8bc1\u768420\u6761MySQL 8.0\u8c03\u4f18\u7ecf\u9a8c&#xff0c;\u6db5\u76d6\u7d22\u5f15\u4f18\u5316\u3001\u6162\u67e5\u8be2\u5206\u6790\u3001InnoDB\u53c2\u6570\u3001SQL\u4f18\u5316\u3001\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868\u5168\u94fe\u8def&#xff0c;\u6bcf\u6761\u90fd\u6709\u771f\u5b9e\u6848\u4f8b\u652f\u6491\u3002\u4e00\u3001\u7d22\u5f15\u4f18\u5316&#xff1a;80%\u7684\u6027\u80fd\u95ee\u9898\u51fa\u5728\u8fd9\u91cc1.1 \u8986\u76d6\u7d22\u5f15&#xff1a;\u907f\u514d\u56de\u8868&#8211; \u5047\u8bbe\u6709\u4e00\u5f20\u7528\u6237\u8868CREATE TABLE users (id BIGINT PRIMARY KEY AUTO_INCREMENT,us<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[114,97,56,100,351],"topic":[],"class_list":["post-90767","post","type-post","status-publish","format-standard","hentry","category-server","tag-mysql","tag-97","tag-56","tag-100","tag-351"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/90767.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"MySQL\u6027\u80fd\u4f18\u5316\u662f\u540e\u7aef\u5f00\u53d1\u548cDBA\u7684\u5fc5\u4fee\u8bfe\u3002\u672c\u6587\u6574\u7406\u4e86\u7b14\u8005\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5b9e\u6218\u9a8c\u8bc1\u768420\u6761MySQL 8.0\u8c03\u4f18\u7ecf\u9a8c&#xff0c;\u6db5\u76d6\u7d22\u5f15\u4f18\u5316\u3001\u6162\u67e5\u8be2\u5206\u6790\u3001InnoDB\u53c2\u6570\u3001SQL\u4f18\u5316\u3001\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868\u5168\u94fe\u8def&#xff0c;\u6bcf\u6761\u90fd\u6709\u771f\u5b9e\u6848\u4f8b\u652f\u6491\u3002\u4e00\u3001\u7d22\u5f15\u4f18\u5316&#xff1a;80%\u7684\u6027\u80fd\u95ee\u9898\u51fa\u5728\u8fd9\u91cc1.1 \u8986\u76d6\u7d22\u5f15&#xff1a;\u907f\u514d\u56de\u8868-- \u5047\u8bbe\u6709\u4e00\u5f20\u7528\u6237\u8868CREATE TABLE users (id BIGINT PRIMARY KEY AUTO_INCREMENT,us\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/90767.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-05T14:24:45+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/90767.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/90767.html\",\"name\":\"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-05T14:24:45+00:00\",\"dateModified\":\"2026-08-05T14:24:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/90767.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/90767.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/90767.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/90767.html","og_locale":"zh_CN","og_type":"article","og_title":"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"MySQL\u6027\u80fd\u4f18\u5316\u662f\u540e\u7aef\u5f00\u53d1\u548cDBA\u7684\u5fc5\u4fee\u8bfe\u3002\u672c\u6587\u6574\u7406\u4e86\u7b14\u8005\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u5b9e\u6218\u9a8c\u8bc1\u768420\u6761MySQL 8.0\u8c03\u4f18\u7ecf\u9a8c&#xff0c;\u6db5\u76d6\u7d22\u5f15\u4f18\u5316\u3001\u6162\u67e5\u8be2\u5206\u6790\u3001InnoDB\u53c2\u6570\u3001SQL\u4f18\u5316\u3001\u8bfb\u5199\u5206\u79bb\u4e0e\u5206\u5e93\u5206\u8868\u5168\u94fe\u8def&#xff0c;\u6bcf\u6761\u90fd\u6709\u771f\u5b9e\u6848\u4f8b\u652f\u6491\u3002\u4e00\u3001\u7d22\u5f15\u4f18\u5316&#xff1a;80%\u7684\u6027\u80fd\u95ee\u9898\u51fa\u5728\u8fd9\u91cc1.1 \u8986\u76d6\u7d22\u5f15&#xff1a;\u907f\u514d\u56de\u8868-- \u5047\u8bbe\u6709\u4e00\u5f20\u7528\u6237\u8868CREATE TABLE users (id BIGINT PRIMARY KEY AUTO_INCREMENT,us","og_url":"https:\/\/www.wsisp.com\/helps\/90767.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-05T14:24:45+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/90767.html","url":"https:\/\/www.wsisp.com\/helps\/90767.html","name":"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-05T14:24:45+00:00","dateModified":"2026-08-05T14:24:45+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/90767.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/90767.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/90767.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MySQL 8.0\u6027\u80fd\u4f18\u5316\u7ec8\u6781\u6307\u5357\uff1a20\u6761\u786c\u6838\u8c03\u4f18\u7ecf\u9a8c\uff082026\u6700\u65b0\u7248\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/90767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=90767"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/90767\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=90767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=90767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=90767"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=90767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}