<?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: Should you name indexes while doing ALTER TABLE ?</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 21 Nov 2009 05:23:57 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: krteQ</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-311998</link>
		<dc:creator>krteQ</dc:creator>
		<pubDate>Tue, 10 Jun 2008 15:18:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-311998</guid>
		<description>I just add, that this problem doubles while using FOREIGN KEYS. You just drop a foreign key and think the DELETE will perform how you expect, but...</description>
		<content:encoded><![CDATA[<p>I just add, that this problem doubles while using FOREIGN KEYS. You just drop a foreign key and think the DELETE will perform how you expect, but&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gregory Haase</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306902</link>
		<dc:creator>Gregory Haase</dc:creator>
		<pubDate>Fri, 30 May 2008 20:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306902</guid>
		<description>I was really surprised to discover that mySQL does not support naming the primary key. If you select contraint_name from information_schema.table_constraints, you get an aweful lot of constraints named &quot;PRIMARY&quot;.  Do we really need this here, we have another column in the same table called constraint_type which happily tells us it&#039;s a PRIMARY KEY.

But what surprised me the most was the fact that the following syntax does not produce an error:


CREATE TABLE `test`.`testing`
(   testing_id   INT  NOT NULL auto_increment,
    PRIMARY KEY `pk_testing` (`testing_id`)
);


You table will be happily created with primary key, but when you do a show create table, you get the following:


 CREATE TABLE `testing` (
  `testing_id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`testing_id`)
)



As far as naming conventions, I usually name my foreign key constraints fk__ and my indexes i__# (and up until about 10 minutes ago I was naming my primary key constraints pk_).</description>
		<content:encoded><![CDATA[<p>I was really surprised to discover that mySQL does not support naming the primary key. If you select contraint_name from information_schema.table_constraints, you get an aweful lot of constraints named &#8220;PRIMARY&#8221;.  Do we really need this here, we have another column in the same table called constraint_type which happily tells us it&#8217;s a PRIMARY KEY.</p>
<p>But what surprised me the most was the fact that the following syntax does not produce an error:</p>
<p>CREATE TABLE `test`.`testing`<br />
(   testing_id   INT  NOT NULL auto_increment,<br />
    PRIMARY KEY `pk_testing` (`testing_id`)<br />
);</p>
<p>You table will be happily created with primary key, but when you do a show create table, you get the following:</p>
<p> CREATE TABLE `testing` (<br />
  `testing_id` int(11) NOT NULL AUTO_INCREMENT,<br />
  PRIMARY KEY (`testing_id`)<br />
)</p>
<p>As far as naming conventions, I usually name my foreign key constraints fk__ and my indexes i__# (and up until about 10 minutes ago I was naming my primary key constraints pk_).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306582</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Thu, 29 May 2008 17:05:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306582</guid>
		<description>Olexandr,

Thanks I changed prefix to suffix.</description>
		<content:encoded><![CDATA[<p>Olexandr,</p>
<p>Thanks I changed prefix to suffix.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olexandr Melnyk</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306560</link>
		<dc:creator>Olexandr Melnyk</dc:creator>
		<pubDate>Thu, 29 May 2008 15:43:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306560</guid>
		<description>&gt; No, it won’t. It stops at 64.
&gt; (Don’t ask me how I know…)

This applies not just to duplicate indexes, but is a generic MyISAM limitation.</description>
		<content:encoded><![CDATA[<p>&gt; No, it won’t. It stops at 64.<br />
&gt; (Don’t ask me how I know…)</p>
<p>This applies not just to duplicate indexes, but is a generic MyISAM limitation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306558</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Thu, 29 May 2008 15:38:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306558</guid>
		<description>&gt; What happens if you try to create the same index without specifying index
&gt; name?  MySQL will happily create (and maintain) as many duplicate keys as you
&gt; like without even giving you a warning:

No, it won&#039;t.  It stops at 64.
(Don&#039;t ask me how I know...)

- Eric</description>
		<content:encoded><![CDATA[<p>&gt; What happens if you try to create the same index without specifying index<br />
&gt; name?  MySQL will happily create (and maintain) as many duplicate keys as you<br />
&gt; like without even giving you a warning:</p>
<p>No, it won&#8217;t.  It stops at 64.<br />
(Don&#8217;t ask me how I know&#8230;)</p>
<p>- Eric</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olexandr Melnyk</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306557</link>
		<dc:creator>Olexandr Melnyk</dc:creator>
		<pubDate>Thu, 29 May 2008 15:34:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306557</guid>
		<description>&gt; it will add numeric prefix to it

It&#039;s a postfix or a suffix, but not a prefix ;)</description>
		<content:encoded><![CDATA[<p>&gt; it will add numeric prefix to it</p>
<p>It&#8217;s a postfix or a suffix, but not a prefix <img src='http://www.mysqlperformanceblog.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306393</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Thu, 29 May 2008 05:32:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306393</guid>
		<description>Monty, 

I surely agree. Though I would make sure the index type is same as well (it is OK to have column indexes as normal BTREE index and FullText for example)
Regarding but reports  - you should be in the best position to post them as MySQL/Sun employee.

I think I proposed fixing first one but it did not ended up going any where.</description>
		<content:encoded><![CDATA[<p>Monty, </p>
<p>I surely agree. Though I would make sure the index type is same as well (it is OK to have column indexes as normal BTREE index and FullText for example)<br />
Regarding but reports  &#8211; you should be in the best position to post them as MySQL/Sun employee.</p>
<p>I think I proposed fixing first one but it did not ended up going any where.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Monty Taylor</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306392</link>
		<dc:creator>Monty Taylor</dc:creator>
		<pubDate>Thu, 29 May 2008 05:24:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306392</guid>
		<description>Seems like there are a couple of bug/feature requests in this post too. (to me, at least) 

- MySQL allows duplicate identical index creation

(I can see no reason why two indexes on the exact same column would be useful - but maybe I&#039;m wrong) 

- MySQL creates crap auto_generated names

Instead of just using the first column name as the index name, how about firstcolumn_secondcolumn_thirdcolumn - etc - until it runs out of space? This is a common practice in the field anyway. (As is prefixing idx_ - although I don&#039;t like this very much myself) 

Anybody want to file there?</description>
		<content:encoded><![CDATA[<p>Seems like there are a couple of bug/feature requests in this post too. (to me, at least) </p>
<p>- MySQL allows duplicate identical index creation</p>
<p>(I can see no reason why two indexes on the exact same column would be useful &#8211; but maybe I&#8217;m wrong) </p>
<p>- MySQL creates crap auto_generated names</p>
<p>Instead of just using the first column name as the index name, how about firstcolumn_secondcolumn_thirdcolumn &#8211; etc &#8211; until it runs out of space? This is a common practice in the field anyway. (As is prefixing idx_ &#8211; although I don&#8217;t like this very much myself) </p>
<p>Anybody want to file there?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306391</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Thu, 29 May 2008 05:17:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306391</guid>
		<description>Peter, 

May be if you get too conservative this is the case, Though you can find a lot of &quot;indexes&quot; used as plural for index.  
Some people say this is also preferred form these days:
http://wiki.answers.com/Q/What_is_the_plural_of_index</description>
		<content:encoded><![CDATA[<p>Peter, </p>
<p>May be if you get too conservative this is the case, Though you can find a lot of &#8220;indexes&#8221; used as plural for index.<br />
Some people say this is also preferred form these days:<br />
<a href="http://wiki.answers.com/Q/What_is_the_plural_of_index" rel="nofollow">http://wiki.answers.com/Q/What_is_the_plural_of_index</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter A. Shevtsov</title>
		<link>http://www.mysqlperformanceblog.com/2008/05/28/should-you-name-indexes-while-doing-alter-table/comment-page-1/#comment-306356</link>
		<dc:creator>Peter A. Shevtsov</dc:creator>
		<pubDate>Thu, 29 May 2008 04:01:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/?p=405#comment-306356</guid>
		<description>The plural form of the word &quot;index&quot; is &quot;indices&quot;</description>
		<content:encoded><![CDATA[<p>The plural form of the word &#8220;index&#8221; is &#8220;indices&#8221;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
