Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4991

Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4993

Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php:4991) in /www/htdocs/v030397/mysql-qotd/wp-includes/feed-rss2-comments.php on line 8
Comments on: Question 73: How will the table look? http://mysql-qotd.casperia.net/archives/490 mysql 5.0/5.1 questions for learning purposes Fri, 06 Aug 2010 16:56:36 +0000 http://wordpress.org/?v=abc hourly 1 By: plogi http://mysql-qotd.casperia.net/archives/490/comment-page-1#comment-83 plogi Sun, 20 Jun 2010 12:36:29 +0000 http://mysql-qotd.casperia.net/?p=490#comment-83 <b> b Three indexes on the same column will be created! If seen this in production databases, and it just makes things slow and uses extra storage. When creating DDL, give indexes a name, then this cannot happen. <small> MariaDB [tt]> show create table bla_di_da\G *************************** 1. row *************************** Table: bla_di_da Create Table: CREATE TABLE `bla_di_da` ( `bla` int(11) DEFAULT NULL, `di` int(11) DEFAULT NULL, `da` int(11) DEFAULT NULL, KEY `di` (`di`), KEY `di_2` (`di`), KEY `di_3` (`di`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 1 row in set (0.00 sec) </small></b>
b

Three indexes on the same column will be created! If seen this in production databases, and it just makes things slow and uses extra storage. When creating DDL, give indexes a name, then this cannot happen.


MariaDB [tt]> show create table bla_di_da\G
*************************** 1. row ***************************
Table: bla_di_da
Create Table: CREATE TABLE `bla_di_da` (
`bla` int(11) DEFAULT NULL,
`di` int(11) DEFAULT NULL,
`da` int(11) DEFAULT NULL,
KEY `di` (`di`),
KEY `di_2` (`di`),
KEY `di_3` (`di`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

]]>