<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[MySQL索引分类和各自用途]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Wed, 15 Sep 2010 15:08:14 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	一、 MySQL: 索引以B树格式保存<br/><br/>Memory存储引擎可以选择Hash或BTree索引，Hash索引只能用于=或&lt;=&gt;的等式比较。<br/><br/>1、普通索引：create index on Tablename(列的列表)<br/><br/>alter table TableName add index (列的列表)<br/><br/>create table TableName([...], index [IndexName] (列的列表)<br/><br/>2、唯一性索引：create unique index<br/><br/>alter ... add unique<br/><br/>主键：一种唯一性索引，必须指定为primary key<br/><br/>3、全文索引：从3.23.23版开始支持全文索引和全文检索，FULLTEXT，<br/><br/>可以在char、varchar或text类型的列上创建。<br/><br/>4、单列索引、多列索引：<br/><br/>多个单列索引与单个多列索引的查询效果不同，因为：<br/><br/>执行查询时，MySQL只能使用一个索引，会从多个索引中选择一个限制最为严格的索引。<br/><br/>5、最左前缀(Leftmost Prefixing)：多列索引，例如：fname_lname_age索引，以下的搜索条件MySQL都将使用<br/><br/>fname_lname_age索引：firstname,lastname,age；firstname,lastname；firstname，其他情况将不使用。<br/><br/>二、根据sql查询语句确定创建哪种类型的索引，如何优化查询<br/><br/>选择索引列：<br/><br/>a.性能优化过程中，选择在哪个列上创建索引是最重要的步骤之一。可以考虑使用索引的主要有<br/><br/>两种类型的列：在where子句中出现的列，在join子句中出现的列。<br/><br/>b.考虑列中值的分布，索引的列的基数越大，索引的效果越好。<br/><br/>c.使用短索引，如果对字符串列进行索引，应该指定一个前缀长度，可节省大量索引空间，提升查询速度。<br/><br/>d.利用最左前缀<br/><br/>e.不要过度索引，只保持所需的索引。每个额外的索引都要占用额外的磁盘空间，并降低写操作的性能。<br/><br/>在修改表的内容时，索引必须进行更新，有时可能需要重构，因此，索引越多，所花的时间越长。<br/><br/>MySQL只对一下操作符才使用索引：&lt;,&lt;=,=,&gt;,&gt;=,between,in,<br/><br/>以及某些时候的like(不以通配符%或_开头的情形)。<br/><br/>来源：http://database.51cto.com/art/200905/122789.htm
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] MySQL索引分类和各自用途]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>