June 19, 2013

Post: Understanding the maximum number of columns in a MySQL table

MySQL, the defines can still found in the source. Basically, it’s why we can’t have nice things (like default values…n_length+int_length+com_length > 65535L || int_count > 255) { my_message(ER_TOO_MANY_FIELDS, … many more ENUM(‘Y’,'N’) columns, you can only have 255 ENUM columns with unique values. If…

Post: Efficient Boolean value storage for Innodb Tables

…of flag values means you can’t use normal “=” comparison operator with them: mysql> select count(*) from cbool where c1=NULL; +———-+ | count(*) | +———-+ | 0 | +———-+ … so – for most applications using TINYINT BIT(1) or ENUM for flags benefit would unlikely be worth the trouble. …

Comment: COUNT(*) vs COUNT(col)

…karma` int(11) NOT NULL default ’0′, `comment_approved` enum(’0′,’1′,’spam’) NOT NULL default ’1′, `comment_… actually counting the values but the pointers from this index: mysql> select count( distinct (comment_approved) ) from wp_comments; +————————————–+ | count( distinct …

Post: How (not) to find unused indexes

…` enum(‘archived’,'active’) DEFAULT NULL, PRIMARY KEY (`id`), KEY `status` (`status`) ) ENGINE=MyISAM AUTO_INCREMENT=65691 DEFAULT CHARSET=latin1; mysql> SELECT count(*), status… quote this as an exact percentage, since this value is not fixed in MySQL and can be a much wider window (15…