<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to exploit MySQL index optimizations</title>
	<atom:link href="http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/</link>
	<description>Stay curious!</description>
	<lastBuildDate>Thu, 09 Feb 2012 09:56:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Michael Mior</title>
		<link>http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/#comment-19724</link>
		<dc:creator>Michael Mior</dc:creator>
		<pubDate>Mon, 07 Nov 2011 14:32:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=164#comment-19724</guid>
		<description>I can&#039;t recall the data model, but I have encountered a situation where MySQL would not use an index prefix and a separate index on just the first column produced a vastly different (and superior) query plan.

As I said, I don&#039;t really recall anything about the data, but I&#039;m curious to know if anyone else has experienced this in practice.</description>
		<content:encoded><![CDATA[<p>I can&#8217;t recall the data model, but I have encountered a situation where MySQL would not use an index prefix and a separate index on just the first column produced a vastly different (and superior) query plan.</p>
<p>As I said, I don&#8217;t really recall anything about the data, but I&#8217;m curious to know if anyone else has experienced this in practice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/#comment-19521</link>
		<dc:creator>Xaprb</dc:creator>
		<pubDate>Mon, 01 Aug 2011 20:31:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=164#comment-19521</guid>
		<description>Shashidhar, this is an example of when the query might touch so many columns that you need to use a trick such as the type that Peter Zaitsev calls a &quot;delayed join&quot;, which you can see here: http://www.mysqlperformanceblog.com/2007/04/06/using-delayed-join-to-optimize-count-and-limit-queries/

You might also be interested in this book: http://www.xaprb.com/blog/2010/09/19/a-review-of-relational-database-design-and-the-optimizers-by-lahdenmaki-and-leach/</description>
		<content:encoded><![CDATA[<p>Shashidhar, this is an example of when the query might touch so many columns that you need to use a trick such as the type that Peter Zaitsev calls a &#8220;delayed join&#8221;, which you can see here: <a href="http://www.mysqlperformanceblog.com/2007/04/06/using-delayed-join-to-optimize-count-and-limit-queries/" rel="nofollow">http://www.mysqlperformanceblog.com/2007/04/06/using-delayed-join-to-optimize-count-and-limit-queries/</a></p>
<p>You might also be interested in this book: <a href="http://www.xaprb.com/blog/2010/09/19/a-review-of-relational-database-design-and-the-optimizers-by-lahdenmaki-and-leach/" rel="nofollow">http://www.xaprb.com/blog/2010/09/19/a-review-of-relational-database-design-and-the-optimizers-by-lahdenmaki-and-leach/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shashidhar</title>
		<link>http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/#comment-19520</link>
		<dc:creator>Shashidhar</dc:creator>
		<pubDate>Mon, 01 Aug 2011 07:08:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=164#comment-19520</guid>
		<description>Well, First of all I have to say thanks for such a nice article. 

But I have small questions to clarify here with you. I hope this thread is still alive, and author is there to listen (hopefully).

When you say -
&quot;For MyISAM, put the columns in the WHERE clause first in the index, then add the columns named in the SELECT clause at the end.&quot;

say, I have a table(tableA) with 50 columns and couple of them have index&#039;s (single/individually). But selection is based on something like this
1. select tableA.col1, tableA.col2,tableA.col3, tableA.col4, tableA.col5,tableA,col6, tableA,col7, tableA.col8, tableA.col9, tableA.col10 from tableA where col15= AND col16=

In this scenario, and after your suggestion, I understand I have to create index on (col15, col16, col1,col2,col3...col10) Correct?

But this seems to be huge index? My doubt, how true is your statement for huge tables (with more columns, specially?)

Could you please clarify my doubt please? 

Cheers in advance,

Shashidhar</description>
		<content:encoded><![CDATA[<p>Well, First of all I have to say thanks for such a nice article. </p>
<p>But I have small questions to clarify here with you. I hope this thread is still alive, and author is there to listen (hopefully).</p>
<p>When you say -<br />
&#8220;For MyISAM, put the columns in the WHERE clause first in the index, then add the columns named in the SELECT clause at the end.&#8221;</p>
<p>say, I have a table(tableA) with 50 columns and couple of them have index&#8217;s (single/individually). But selection is based on something like this<br />
1. select tableA.col1, tableA.col2,tableA.col3, tableA.col4, tableA.col5,tableA,col6, tableA,col7, tableA.col8, tableA.col9, tableA.col10 from tableA where col15= AND col16=</p>
<p>In this scenario, and after your suggestion, I understand I have to create index on (col15, col16, col1,col2,col3&#8230;col10) Correct?</p>
<p>But this seems to be huge index? My doubt, how true is your statement for huge tables (with more columns, specially?)</p>
<p>Could you please clarify my doubt please? </p>
<p>Cheers in advance,</p>
<p>Shashidhar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toto</title>
		<link>http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/#comment-19084</link>
		<dc:creator>toto</dc:creator>
		<pubDate>Mon, 24 Jan 2011 00:59:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=164#comment-19084</guid>
		<description>&gt; Since InnoDB secondary indexes already contain all columns from the primary key, 
&gt; there’s no need to add them to the secondary index unless the index needs them at the front of the index. 
&gt; In particular, adding an index on (price, variety) to the apples table above is completely redundant. 

I don&#039;t think so. (I know, this article have been written long time ago.)

I created table like below.
----------------------------------------------------------------------------------------
CREATE TABLE tab_lsu (
  fdpk1 char(10) NOT NULL,
  fdpk2 char(10) NOT NULL,
  fd3 char(10) DEFAULT NULL,
  fd4 char(10) DEFAULT NULL,
  PRIMARY KEY (fdpk1,fdpk2),
  KEY ix_fd3_fdpk1_fdpk2 (fd3,fdpk1,fdpk2),
  KEY ix_fdpk1_fd3 (fdpk1,fd3),
  KEY ix_fd3 (fd3)
) ENGINE=InnoDB DEFAULT ROW_FORMAT=COMPACT -- // (and also test REDUNDANT ROW_FORMAT)
----------------------------------------------------------------------------------------

InnoDB&#039;s table monitor print out like this
----------------------------------------------------------------------------------------
  INDEX: name ix_fd3_fdpk1_fdpk2, id 0 978, fields 3/3, uniq 3, type 0
   root page 4, appr.key vals 16030, leaf pages 39, size pages 97
   FIELDS:  
	fd3 
	fdpk1 
	fdpk2

  INDEX: name ix_fdpk1_fd3, id 0 979, fields 2/3, uniq 3, type 0
   root page 5, appr.key vals 15991, leaf pages 39, size pages 97
   FIELDS:  
	fdpk1 
	fd3 
	fdpk2

  INDEX: name ix_fd3, id 0 980, fields 1/3, uniq 3, type 0
   root page 6, appr.key vals 15991, leaf pages 39, size pages 97
   FIELDS:  
	fd3 
	fdpk1 
	fdpk2
----------------------------------------------------------------------------------------

And I dumped these 3 index&#039;s pages. (all 3 index have only one index page)
(But index&#039;s page contents never changed when index pages is greater than 2)




----------------------------------------------------------------------------------------
ix_fd3_fdpk1_fdpk2

[root@toto:~/temp/innodb-recovery-0.3/result/pages-1295763380/0-978]$ hexdump -v -C 4-00000004.page
00000000  0d 19 f0 3c 00 00 00 04  ff ff ff ff ff ff ff ff  &#124;..&lt;....&#124;
00000010  00 00 00 03 aa b4 02 15  45 bf 00 00 00 00 00 00  &#124;....E...&#124;
00000020  00 00 00 00 01 ef 00 0a  07 05 80 29 00 00 00 00  &#124;..........)....&#124;
00000030  06 e3 00 02 00 26 00 27  00 00 00 00 00 00 00 00  &#124;....&amp;.&#039;........&#124;
00000040  00 01 00 00 00 00 00 00  03 d2 00 00 01 ef 00 00  &#124;..............&#124;
00000050  00 02 02 72 00 00 01 ef  00 00 00 02 01 b2 01 00  &#124;...r........

00000060  02 00 1e 69 6e 66 69 6d  75 6d 00 08 00 0b 00 00  &#124;...infimum......&#124;
00000070  73 75 70 72 65 6d 75 6d  0a 0a 0a 00 10 00 11 00  &#124;supremum........&#124;
00000080  2b 46 44 33 23 23 23 23  23 23 23 50 4b 31 23 23  &#124;+FD3#######PK1##&#124;
00000090  23 23 23 23 23 50 4b 32  23 23 23 23 23 23 23 00  &#124;#####PK2#######.&#124;
000000a0  00 00 0a 0a 0a 0a 00 00  00 19 00 2b 46 44 33 30  &#124;...........+FD30&#124;
000000b0  30 30 30 32 30 35 50 4b  31 30 30 30 30 32 30 35  &#124;000205PK10000205&#124;
000000c0  50 4b 32 30 30 30 30 32  30 35 00 00 00 0b 0a 0a  &#124;PK20000205......&#124;
000000d0  0a 00 00 00 21 00 2b 46  44 33 30 30 30 30 36 31  &#124;....!.+FD3000061&#124;
000000e0  36 50 4b 31 30 30 30 30  36 31 36 50 4b 32 30 30  &#124;6PK10000616PK200&#124;
000000f0  30 30 36 31 36 00 00 00  11 0a 0a 0a 00 04 00 29  &#124;00616..........)&#124;
00000100  00 2b 46 44 33 30 30 30  31 30 32 37 50 4b 31 30  &#124;.+FD30001027PK10&#124;
00000110  30 30 31 30 32 37 50 4b  32 30 30 30 31 30 32 37  &#124;001027PK20001027&#124;
00000120  00 00 00 15 0a 0a 0a 00  00 00 31 00 2b 46 44 33  &#124;..........1.+FD3&#124;
00000130  30 30 30 31 34 33 38 50  4b 31 30 30 30 31 34 33  &#124;0001438PK1000143&#124;
00000140  38 50 4b 32 30 30 30 31  34 33 38 00 00 00 1a 0a  &#124;8PK20001438.....&#124;
----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------
ix_fdpk1_fd3

[root@toto:~/temp/innodb-recovery-0.3/result/pages-1295763380/0-979]$ hexdump -v -C 5-00000005.page
00000000  0b f0 fa 66 00 00 00 05  ff ff ff ff ff ff ff ff  &#124;....&#124;
00000010  00 00 00 03 aa b4 03 01  45 bf 00 00 00 00 00 00  &#124;....E...&#124;
00000020  00 00 00 00 01 ef 00 0a  07 05 80 29 00 00 00 00  &#124;..........)....&#124;
00000030  06 e3 00 02 00 26 00 27  00 00 00 00 00 00 00 00  &#124;....&amp;.&#039;........&#124;
00000040  00 01 00 00 00 00 00 00  03 d3 00 00 01 ef 00 00  &#124;..............&#124;
00000050  00 02 03 f2 00 00 01 ef  00 00 00 02 03 32 01 00  &#124;...........2..&#124;
00000060  02 00 1e 69 6e 66 69 6d  75 6d 00 08 00 0b 00 00  &#124;...infimum......&#124;
00000070  73 75 70 72 65 6d 75 6d  0a 0a 0a 00 10 00 11 00  &#124;supremum........&#124;
00000080  2b 50 4b 31 23 23 23 23  23 23 23 46 44 33 23 23  &#124;+PK1#######FD3##&#124;
00000090  23 23 23 23 23 50 4b 32  23 23 23 23 23 23 23 00  &#124;#####PK2#######.&#124;
000000a0  00 00 0c 0a 0a 0a 00 00  00 19 00 2b 50 4b 31 30  &#124;...........+PK10&#124;
000000b0  30 30 30 32 30 35 46 44  33 30 30 30 30 32 30 35  &#124;000205FD30000205&#124;
000000c0  50 4b 32 30 30 30 30 32  30 35 00 00 00 0d 0a 0a  &#124;PK20000205......&#124;
000000d0  0a 00 00 00 21 00 2b 50  4b 31 30 30 30 30 36 31  &#124;....!.+PK1000061&#124;
000000e0  36 46 44 33 30 30 30 30  36 31 36 50 4b 32 30 30  &#124;6FD30000616PK200&#124;
000000f0  30 30 36 31 36 00 00 00  12 0a 0a 0a 00 04 00 29  &#124;00616..........)&#124;
00000100  00 2b 50 4b 31 30 30 30  31 30 32 37 46 44 33 30  &#124;.+PK10001027FD30&#124;
00000110  30 30 31 30 32 37 50 4b  32 30 30 30 31 30 32 37  &#124;001027PK20001027&#124;
00000120  00 00 00 16 0a 0a 0a 00  00 00 31 00 2b 50 4b 31  &#124;..........1.+PK1&#124;
00000130  30 30 30 31 34 33 38 46  44 33 30 30 30 31 34 33  &#124;0001438FD3000143&#124;
00000140  38 50 4b 32 30 30 30 31  34 33 38 00 00 00 1b 0a  &#124;8PK20001438.....&#124;
----------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------
ix_fd3
[root@toto:~/temp/innodb-recovery-0.3/result/pages-1295763380/0-980]$ hexdump -v -C  6-00000006.page
00000000  1d 9d 1b 81 00 00 00 06  ff ff ff ff ff ff ff ff  &#124;........&#124;
00000010  00 00 00 03 aa b4 03 ed  45 bf 00 00 00 00 00 00  &#124;....E...&#124;
00000020  00 00 00 00 01 ef 00 0a  07 05 80 29 00 00 00 00  &#124;..........)....&#124;
00000030  06 e3 00 02 00 26 00 27  00 00 00 00 00 00 00 00  &#124;....&amp;.&#039;........&#124;
00000040  00 01 00 00 00 00 00 00  03 d4 00 00 01 ef 00 00  &#124;..............&#124;
00000050  00 02 05 72 00 00 01 ef  00 00 00 02 04 b2 01 00  &#124;...r........
00000060  02 00 1e 69 6e 66 69 6d  75 6d 00 08 00 0b 00 00  &#124;...infimum......&#124;
00000070  73 75 70 72 65 6d 75 6d  0a 0a 0a 00 10 00 11 00  &#124;supremum........&#124;
00000080  2b 46 44 33 23 23 23 23  23 23 23 50 4b 31 23 23  &#124;+FD3#######PK1##&#124;
00000090  23 23 23 23 23 50 4b 32  23 23 23 23 23 23 23 00  &#124;#####PK2#######.&#124;
000000a0  00 00 0e 0a 0a 0a 00 00  00 19 00 2b 46 44 33 30  &#124;...........+FD30&#124;
000000b0  30 30 30 32 30 35 50 4b  31 30 30 30 30 32 30 35  &#124;000205PK10000205&#124;
000000c0  50 4b 32 30 30 30 30 32  30 35 00 00 00 0f 0a 0a  &#124;PK20000205......&#124;
000000d0  0a 00 00 00 21 00 2b 46  44 33 30 30 30 30 36 31  &#124;....!.+FD3000061&#124;
000000e0  36 50 4b 31 30 30 30 30  36 31 36 50 4b 32 30 30  &#124;6PK10000616PK200&#124;
000000f0  30 30 36 31 36 00 00 00  13 0a 0a 0a 00 04 00 29  &#124;00616..........)&#124;
00000100  00 2b 46 44 33 30 30 30  31 30 32 37 50 4b 31 30  &#124;.+FD30001027PK10&#124;
00000110  30 30 31 30 32 37 50 4b  32 30 30 30 31 30 32 37  &#124;001027PK20001027&#124;
00000120  00 00 00 17 0a 0a 0a 00  00 00 31 00 2b 46 44 33  &#124;..........1.+FD3&#124;
00000130  30 30 30 31 34 33 38 50  4b 31 30 30 30 31 34 33  &#124;0001438PK1000143&#124;
00000140  38 50 4b 32 30 30 30 31  34 33 38 00 00 00 1c 0a  &#124;8PK20001438.....&#124;
00000150  0a 0a 00 00 00 39 00 2b  46 44 33 30 30 30 31 38  &#124;.....9.+FD300018&#124;
00000160  34 39 50 4b 31 30 30 30  31 38 34 39 50 4b 32 30  &#124;49PK10001849PK20&#124;
00000170  30 30 31 38 34 39 00 00  00 21 0a 0a 0a 00 00 00  &#124;001849...!......&#124;
----------------------------------------------------------------------------------------

And all dumped result are same whether row_format is REDUNDANT or COMPACT ( have not test baracuda file format yet.)


So, I think, 
&quot;INDEX (not_pk_column + pk_column1 + pk_column2)&quot; and &quot;INDEX (not_pk_column)&quot; index have same internal structure.
the only different thing is second index have only 1 user defined index column, but first case have 3 user defined index column.

And &quot;INDEX (pk_column1 + not_pk_column + pk_column2)&quot; and &quot;INDEX (pk_column1 + not_pk_column)&quot; are same.

Finally (If this is right), 
Index columns are same whether I defined or not trailing primary key columns, I think first case is better than second case.
In Second case, other people cannot notice that the creator really expected appended primary key for sort or group by or else.
For example,
  If table&#039;s index is &quot;INDEX (fd1)&quot;, you can&#039;t tell the creator of index want &quot;INDEX (fd1 + fd_pk)&quot; or &quot;INDEX(fd1)&quot;.
  But, in this case the index is created with &quot;INDEX (fd1 + fd_pk)&quot;, then we can tell this index&#039;s Primary key column is also used 
  for searching or grouping or sorting... 

What do you think about this. ?</description>
		<content:encoded><![CDATA[<p>&gt; Since InnoDB secondary indexes already contain all columns from the primary key,<br />
&gt; there’s no need to add them to the secondary index unless the index needs them at the front of the index.<br />
&gt; In particular, adding an index on (price, variety) to the apples table above is completely redundant. </p>
<p>I don&#8217;t think so. (I know, this article have been written long time ago.)</p>
<p>I created table like below.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
CREATE TABLE tab_lsu (<br />
  fdpk1 char(10) NOT NULL,<br />
  fdpk2 char(10) NOT NULL,<br />
  fd3 char(10) DEFAULT NULL,<br />
  fd4 char(10) DEFAULT NULL,<br />
  PRIMARY KEY (fdpk1,fdpk2),<br />
  KEY ix_fd3_fdpk1_fdpk2 (fd3,fdpk1,fdpk2),<br />
  KEY ix_fdpk1_fd3 (fdpk1,fd3),<br />
  KEY ix_fd3 (fd3)<br />
) ENGINE=InnoDB DEFAULT ROW_FORMAT=COMPACT &#8212; // (and also test REDUNDANT ROW_FORMAT)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>InnoDB&#8217;s table monitor print out like this<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
  INDEX: name ix_fd3_fdpk1_fdpk2, id 0 978, fields 3/3, uniq 3, type 0<br />
   root page 4, appr.key vals 16030, leaf pages 39, size pages 97<br />
   FIELDS:<br />
	fd3<br />
	fdpk1<br />
	fdpk2</p>
<p>  INDEX: name ix_fdpk1_fd3, id 0 979, fields 2/3, uniq 3, type 0<br />
   root page 5, appr.key vals 15991, leaf pages 39, size pages 97<br />
   FIELDS:<br />
	fdpk1<br />
	fd3<br />
	fdpk2</p>
<p>  INDEX: name ix_fd3, id 0 980, fields 1/3, uniq 3, type 0<br />
   root page 6, appr.key vals 15991, leaf pages 39, size pages 97<br />
   FIELDS:<br />
	fd3<br />
	fdpk1<br />
	fdpk2<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>And I dumped these 3 index&#8217;s pages. (all 3 index have only one index page)<br />
(But index&#8217;s page contents never changed when index pages is greater than 2)</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
ix_fd3_fdpk1_fdpk2</p>
<p>[root@toto:~/temp/innodb-recovery-0.3/result/pages-1295763380/0-978]$ hexdump -v -C 4-00000004.page<br />
00000000  0d 19 f0 3c 00 00 00 04  ff ff ff ff ff ff ff ff  |..&lt;&#8230;.|<br />
00000010  00 00 00 03 aa b4 02 15  45 bf 00 00 00 00 00 00  |&#8230;.E&#8230;|<br />
00000020  00 00 00 00 01 ef 00 0a  07 05 80 29 00 00 00 00  |&#8230;&#8230;&#8230;.)&#8230;.|<br />
00000030  06 e3 00 02 00 26 00 27  00 00 00 00 00 00 00 00  |&#8230;.&amp;.&#039;&#8230;&#8230;..|<br />
00000040  00 01 00 00 00 00 00 00  03 d2 00 00 01 ef 00 00  |&#8230;&#8230;&#8230;&#8230;..|<br />
00000050  00 02 02 72 00 00 01 ef  00 00 00 02 01 b2 01 00  |&#8230;r&#8230;&#8230;..</p>
<p>00000060  02 00 1e 69 6e 66 69 6d  75 6d 00 08 00 0b 00 00  |&#8230;infimum&#8230;&#8230;|<br />
00000070  73 75 70 72 65 6d 75 6d  0a 0a 0a 00 10 00 11 00  |supremum&#8230;&#8230;..|<br />
00000080  2b 46 44 33 23 23 23 23  23 23 23 50 4b 31 23 23  |+FD3#######PK1##|<br />
00000090  23 23 23 23 23 50 4b 32  23 23 23 23 23 23 23 00  |#####PK2#######.|<br />
000000a0  00 00 0a 0a 0a 0a 00 00  00 19 00 2b 46 44 33 30  |&#8230;&#8230;&#8230;..+FD30|<br />
000000b0  30 30 30 32 30 35 50 4b  31 30 30 30 30 32 30 35  |000205PK10000205|<br />
000000c0  50 4b 32 30 30 30 30 32  30 35 00 00 00 0b 0a 0a  |PK20000205&#8230;&#8230;|<br />
000000d0  0a 00 00 00 21 00 2b 46  44 33 30 30 30 30 36 31  |&#8230;.!.+FD3000061|<br />
000000e0  36 50 4b 31 30 30 30 30  36 31 36 50 4b 32 30 30  |6PK10000616PK200|<br />
000000f0  30 30 36 31 36 00 00 00  11 0a 0a 0a 00 04 00 29  |00616&#8230;&#8230;&#8230;.)|<br />
00000100  00 2b 46 44 33 30 30 30  31 30 32 37 50 4b 31 30  |.+FD30001027PK10|<br />
00000110  30 30 31 30 32 37 50 4b  32 30 30 30 31 30 32 37  |001027PK20001027|<br />
00000120  00 00 00 15 0a 0a 0a 00  00 00 31 00 2b 46 44 33  |&#8230;&#8230;&#8230;.1.+FD3|<br />
00000130  30 30 30 31 34 33 38 50  4b 31 30 30 30 31 34 33  |0001438PK1000143|<br />
00000140  38 50 4b 32 30 30 30 31  34 33 38 00 00 00 1a 0a  |8PK20001438&#8230;..|<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
ix_fdpk1_fd3</p>
<p>[root@toto:~/temp/innodb-recovery-0.3/result/pages-1295763380/0-979]$ hexdump -v -C 5-00000005.page<br />
00000000  0b f0 fa 66 00 00 00 05  ff ff ff ff ff ff ff ff  |&#8230;.|<br />
00000010  00 00 00 03 aa b4 03 01  45 bf 00 00 00 00 00 00  |&#8230;.E&#8230;|<br />
00000020  00 00 00 00 01 ef 00 0a  07 05 80 29 00 00 00 00  |&#8230;&#8230;&#8230;.)&#8230;.|<br />
00000030  06 e3 00 02 00 26 00 27  00 00 00 00 00 00 00 00  |&#8230;.&amp;.&#039;&#8230;&#8230;..|<br />
00000040  00 01 00 00 00 00 00 00  03 d3 00 00 01 ef 00 00  |&#8230;&#8230;&#8230;&#8230;..|<br />
00000050  00 02 03 f2 00 00 01 ef  00 00 00 02 03 32 01 00  |&#8230;&#8230;&#8230;..2..|<br />
00000060  02 00 1e 69 6e 66 69 6d  75 6d 00 08 00 0b 00 00  |&#8230;infimum&#8230;&#8230;|<br />
00000070  73 75 70 72 65 6d 75 6d  0a 0a 0a 00 10 00 11 00  |supremum&#8230;&#8230;..|<br />
00000080  2b 50 4b 31 23 23 23 23  23 23 23 46 44 33 23 23  |+PK1#######FD3##|<br />
00000090  23 23 23 23 23 50 4b 32  23 23 23 23 23 23 23 00  |#####PK2#######.|<br />
000000a0  00 00 0c 0a 0a 0a 00 00  00 19 00 2b 50 4b 31 30  |&#8230;&#8230;&#8230;..+PK10|<br />
000000b0  30 30 30 32 30 35 46 44  33 30 30 30 30 32 30 35  |000205FD30000205|<br />
000000c0  50 4b 32 30 30 30 30 32  30 35 00 00 00 0d 0a 0a  |PK20000205&#8230;&#8230;|<br />
000000d0  0a 00 00 00 21 00 2b 50  4b 31 30 30 30 30 36 31  |&#8230;.!.+PK1000061|<br />
000000e0  36 46 44 33 30 30 30 30  36 31 36 50 4b 32 30 30  |6FD30000616PK200|<br />
000000f0  30 30 36 31 36 00 00 00  12 0a 0a 0a 00 04 00 29  |00616&#8230;&#8230;&#8230;.)|<br />
00000100  00 2b 50 4b 31 30 30 30  31 30 32 37 46 44 33 30  |.+PK10001027FD30|<br />
00000110  30 30 31 30 32 37 50 4b  32 30 30 30 31 30 32 37  |001027PK20001027|<br />
00000120  00 00 00 16 0a 0a 0a 00  00 00 31 00 2b 50 4b 31  |&#8230;&#8230;&#8230;.1.+PK1|<br />
00000130  30 30 30 31 34 33 38 46  44 33 30 30 30 31 34 33  |0001438FD3000143|<br />
00000140  38 50 4b 32 30 30 30 31  34 33 38 00 00 00 1b 0a  |8PK20001438&#8230;..|<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
ix_fd3<br />
[root@toto:~/temp/innodb-recovery-0.3/result/pages-1295763380/0-980]$ hexdump -v -C  6-00000006.page<br />
00000000  1d 9d 1b 81 00 00 00 06  ff ff ff ff ff ff ff ff  |&#8230;&#8230;..|<br />
00000010  00 00 00 03 aa b4 03 ed  45 bf 00 00 00 00 00 00  |&#8230;.E&#8230;|<br />
00000020  00 00 00 00 01 ef 00 0a  07 05 80 29 00 00 00 00  |&#8230;&#8230;&#8230;.)&#8230;.|<br />
00000030  06 e3 00 02 00 26 00 27  00 00 00 00 00 00 00 00  |&#8230;.&amp;.&#039;&#8230;&#8230;..|<br />
00000040  00 01 00 00 00 00 00 00  03 d4 00 00 01 ef 00 00  |&#8230;&#8230;&#8230;&#8230;..|<br />
00000050  00 02 05 72 00 00 01 ef  00 00 00 02 04 b2 01 00  |&#8230;r&#8230;&#8230;..<br />
00000060  02 00 1e 69 6e 66 69 6d  75 6d 00 08 00 0b 00 00  |&#8230;infimum&#8230;&#8230;|<br />
00000070  73 75 70 72 65 6d 75 6d  0a 0a 0a 00 10 00 11 00  |supremum&#8230;&#8230;..|<br />
00000080  2b 46 44 33 23 23 23 23  23 23 23 50 4b 31 23 23  |+FD3#######PK1##|<br />
00000090  23 23 23 23 23 50 4b 32  23 23 23 23 23 23 23 00  |#####PK2#######.|<br />
000000a0  00 00 0e 0a 0a 0a 00 00  00 19 00 2b 46 44 33 30  |&#8230;&#8230;&#8230;..+FD30|<br />
000000b0  30 30 30 32 30 35 50 4b  31 30 30 30 30 32 30 35  |000205PK10000205|<br />
000000c0  50 4b 32 30 30 30 30 32  30 35 00 00 00 0f 0a 0a  |PK20000205&#8230;&#8230;|<br />
000000d0  0a 00 00 00 21 00 2b 46  44 33 30 30 30 30 36 31  |&#8230;.!.+FD3000061|<br />
000000e0  36 50 4b 31 30 30 30 30  36 31 36 50 4b 32 30 30  |6PK10000616PK200|<br />
000000f0  30 30 36 31 36 00 00 00  13 0a 0a 0a 00 04 00 29  |00616&#8230;&#8230;&#8230;.)|<br />
00000100  00 2b 46 44 33 30 30 30  31 30 32 37 50 4b 31 30  |.+FD30001027PK10|<br />
00000110  30 30 31 30 32 37 50 4b  32 30 30 30 31 30 32 37  |001027PK20001027|<br />
00000120  00 00 00 17 0a 0a 0a 00  00 00 31 00 2b 46 44 33  |&#8230;&#8230;&#8230;.1.+FD3|<br />
00000130  30 30 30 31 34 33 38 50  4b 31 30 30 30 31 34 33  |0001438PK1000143|<br />
00000140  38 50 4b 32 30 30 30 31  34 33 38 00 00 00 1c 0a  |8PK20001438&#8230;..|<br />
00000150  0a 0a 00 00 00 39 00 2b  46 44 33 30 30 30 31 38  |&#8230;..9.+FD300018|<br />
00000160  34 39 50 4b 31 30 30 30  31 38 34 39 50 4b 32 30  |49PK10001849PK20|<br />
00000170  30 30 31 38 34 39 00 00  00 21 0a 0a 0a 00 00 00  |001849&#8230;!&#8230;&#8230;|<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>And all dumped result are same whether row_format is REDUNDANT or COMPACT ( have not test baracuda file format yet.)</p>
<p>So, I think,<br />
&quot;INDEX (not_pk_column + pk_column1 + pk_column2)&quot; and &quot;INDEX (not_pk_column)&quot; index have same internal structure.<br />
the only different thing is second index have only 1 user defined index column, but first case have 3 user defined index column.</p>
<p>And &quot;INDEX (pk_column1 + not_pk_column + pk_column2)&quot; and &quot;INDEX (pk_column1 + not_pk_column)&quot; are same.</p>
<p>Finally (If this is right),<br />
Index columns are same whether I defined or not trailing primary key columns, I think first case is better than second case.<br />
In Second case, other people cannot notice that the creator really expected appended primary key for sort or group by or else.<br />
For example,<br />
  If table&#039;s index is &quot;INDEX (fd1)&quot;, you can&#039;t tell the creator of index want &quot;INDEX (fd1 + fd_pk)&quot; or &quot;INDEX(fd1)&quot;.<br />
  But, in this case the index is created with &quot;INDEX (fd1 + fd_pk)&quot;, then we can tell this index&#039;s Primary key column is also used<br />
  for searching or grouping or sorting&#8230; </p>
<p>What do you think about this. ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Munnabhai [Dhanashree Inc]</title>
		<link>http://www.xaprb.com/blog/2006/07/04/how-to-exploit-mysql-index-optimizations/#comment-18925</link>
		<dc:creator>Munnabhai [Dhanashree Inc]</dc:creator>
		<pubDate>Thu, 18 Nov 2010 12:58:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.xaprb.com/blog/?p=164#comment-18925</guid>
		<description>Nice Help.. Thanks</description>
		<content:encoded><![CDATA[<p>Nice Help.. Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

