<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0</id>
	<title>MySQL 优化：概述 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0"/>
	<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0&amp;action=history"/>
	<updated>2026-05-19T18:46:24Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0&amp;diff=6554&amp;oldid=prev</id>
		<title>2023年3月31日 (五) 15:16 Eijux</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0&amp;diff=6554&amp;oldid=prev"/>
		<updated>2023-03-31T15:16:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年3月31日 (五) 23:16的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MySQL&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MySQL文档&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 关于 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 关于 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0&amp;diff=2667&amp;oldid=prev</id>
		<title>Eijux：​/* 在硬件级别进行优化 */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0&amp;diff=2667&amp;oldid=prev"/>
		<updated>2021-04-23T19:56:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;在硬件级别进行优化&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月24日 (六) 03:56的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l22&quot;&gt;第22行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第22行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 在硬件级别进行优化 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 在硬件级别进行优化 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;随着数据库变得越来越繁忙，任何数据库应用程序最终都会达到硬件极限。 DBA 必须评估是否有可能调整应用程序或重新配置服务器以避免这些瓶颈，或者是否需要更多的硬件资源。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;随着数据库变得越来越繁忙，任何数据库应用程序最终都会达到硬件极限。 DBA 必须评估是否有可能调整应用程序或重新配置服务器以避免这些瓶颈，或者是否需要更多的硬件资源。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;系统瓶颈通常来自以下来源：&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;系统瓶颈通常来自以下来源：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0&amp;diff=2666&amp;oldid=prev</id>
		<title>Eijux：​建立内容为“category:MySQL  == 关于 == &lt;pre&gt; 数据库性能取决于数据库级别的几个因素，例如表、查询和配置设置。这些软件结构会导致在…”的新页面</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E4%BC%98%E5%8C%96%EF%BC%9A%E6%A6%82%E8%BF%B0&amp;diff=2666&amp;oldid=prev"/>
		<updated>2021-04-23T19:55:58Z</updated>

		<summary type="html">&lt;p&gt;建立内容为“&lt;a href=&quot;/%E5%88%86%E7%B1%BB:MySQL&quot; title=&quot;分类:MySQL&quot;&gt;category:MySQL&lt;/a&gt;  == 关于 == &amp;lt;pre&amp;gt; 数据库性能取决于数据库级别的几个因素，例如表、查询和配置设置。这些软件结构会导致在…”的新页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[category:MySQL]]&lt;br /&gt;
&lt;br /&gt;
== 关于 ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
数据库性能取决于数据库级别的几个因素，例如表、查询和配置设置。这些软件结构会导致在硬件级别执行CPU和I/O操作，您必须将这些操作最小化并尽可能提高效率。&lt;br /&gt;
&lt;br /&gt;
在研究数据库性能时，首先要学习软件方面的高级规则和准则，并使用挂钟时间来衡量性能。当您成为专家后，您将了解更多关于内部发生的事情，并开始测量诸如CPU周期和I/O操作之类的事情。&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
典型用户的目标是从现有的软件和硬件配置中获得最佳的数据库性能。高级用户寻找机会来改进MySQL软件本身，或者开发自己的存储引擎和硬件设备来扩展MySQL生态系统。&lt;br /&gt;
&lt;br /&gt;
== 在数据库级别进行优化 ==&lt;br /&gt;
使数据库应用程序快速运行的最重要因素是其基本设计：&lt;br /&gt;
# '''表的结构'''是否正确？特别是，'''列'''是否具有正确的数据类型，以及每个表是否具有适合工作类型的列？例如，执行频繁更新的应用程序通常具有许多表而具有很少的列，而分析大量数据的应用程序通常具有较少的表而具有很多列。&lt;br /&gt;
# 是否有合适的'''索引'''可以提高查询效率？&lt;br /&gt;
# 是否为每个表使用了适当的'''存储引擎'''，并利用了所使用的每个存储引擎的优势和功能？特别是，对于性能和可伸缩性，选择事务存储引擎（例如 InnoDB）或非事务性存储引擎（例如 MyISAM）可能非常重要。&lt;br /&gt;
#* InnoDB 是新表的默认存储引擎。实际上，先进的 InnoDB 性能功能意味着 InnoDB 表经常胜过简单的 MyISAM 表，尤其是对于繁忙的数据库。&lt;br /&gt;
# 每个表都使用适当的'''行格式'''吗？该选择还取决于表使用的存储引擎。特别是，压缩表使用较少的磁盘空间，因此需要较少的磁盘 I/O 来读写数据。压缩适用于具有 InnoDB 表的所有工作负载以及只读的 MyISAM 表。&lt;br /&gt;
# 应用程序是否使用适当的 locking strategy（'''锁策略'''）？例如，通过在可能的情况下允许共享访问，以便数据库操作可以同时运行，并在适当的时候请求独占访问，以使关键操作获得最高优先级。同样，存储引擎的选择很重要。 InnoDB 存储引擎无需您的参与即可处理大多数锁定问题，从而可以更好地并发数据库并减少代码的试验和调整量。&lt;br /&gt;
# 所有用于'''缓存'''的内存区域的尺寸都正确吗？也就是说，足够大以容纳经常访问的数据，但又不能太大以至于它们会使物理内存过载并导致分页。要配置的主要内存区域是 InnoDB “buffer pool”（缓冲池），MyISAM “key cache”（键缓存）和 MySQL “query cache”（查询缓存）。&lt;br /&gt;
&lt;br /&gt;
== 在硬件级别进行优化 ==&lt;br /&gt;
随着数据库变得越来越繁忙，任何数据库应用程序最终都会达到硬件极限。 DBA 必须评估是否有可能调整应用程序或重新配置服务器以避免这些瓶颈，或者是否需要更多的硬件资源。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
系统瓶颈通常来自以下来源：&lt;br /&gt;
# '''磁盘搜索'''。磁盘查找数据需要花费时间。对于现代磁盘，此操作的平均时间通常小于 10 毫秒，因此理论上我们可以执行约 100 秒钟的搜索。这段时间随着新磁盘的使用而缓慢改善，并且很难为单个表进行优化。优化寻道时间的方法是将数据分发到多个磁盘上。&lt;br /&gt;
# '''磁盘读写'''。当磁盘位于正确的位置时，我们需要读取或写入数据。使用现代磁盘，一个磁盘至少可提供 10–20MB/s 的吞吐量。与查找相比，优化起来更容易，因为您可以从多个磁盘并行读取。&lt;br /&gt;
# '''CPU 周期'''。当数据位于主存储器中时，我们必须对其进行处理以获得结果。与内存量相比，拥有较大的表是最常见的限制因素。但是对于小表，速度通常不是问题。&lt;br /&gt;
# '''内存带宽'''。当 CPU 需要的数据超出 CPU 缓存的容量时，主内存带宽将成为瓶颈。对于大多数系统来说，这是一个不常见的瓶颈，但是要意识到这一点。&lt;br /&gt;
&lt;br /&gt;
== 平衡可移植性和性能 ==&lt;br /&gt;
要在可移植的 MySQL 程序中使用面向性能的 SQL 扩展，可以在“/*! */”注释分隔符内的语句中包装特定于 MySQL 的关键字。其他 SQL Server 忽略注释的关键字。&lt;/div&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
</feed>