MySQL Forums
Forum List  »  Performance

IT'S A BUG!
Posted by: joustin
Date: October 05, 2005 11:49PM

No subqueries, no OR's... I know the differences between versions.
Please take a minute to analize the queries -these can't be any simplier.

IT'S A BUG! Never would have happened under version 3.x ... and never happened.
Giving an unused table to FROM clause chockes the engine - I would understand it if it was about hundreds tousands of rows, but take a look at the actual numbers....

outgoing table: 1 665 rows MyISAM = 88,7 KB
outgoing2 table: 13 656 rows MyISAM = 2,8 MB



EXPLAIN SELECT DISTINCT o2.id, sum( o2.qtt ) AS sum, (
sum( o2.qtt ) /17598716
) AS
`share` FROM outgoing2 AS o2, outgoing AS o
GROUP BY o2.id
ORDER BY o2.id ASC


+----+-------------+-------+-------+---------------+---------+---------+------+-------+----------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+-------+---------------+---------+---------+------+-------+----------------------------------------------+
| 1 | SIMPLE | o | index | NULL | PRIMARY | 4 | NULL | 1665 | Using index; Using temporary; Using filesort |
| 1 | SIMPLE | o2 | ALL | NULL | NULL | NULL | NULL | 13656 | |
+----+-------------+-------+-------+---------------+---------+---------+------+-------+----------------------------------------------+

EXPLAIN SELECT DISTINCT o2.id, sum( o2.qtt ) AS sum, (
sum( o2.qtt ) /17598716
) AS
`share` FROM outgoing2 AS o2
GROUP BY o2.id
ORDER BY o2.id ASC

+----+-------------+-------+------+---------------+------+---------+------+-------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+------+---------------+------+---------+------+-------+---------------------------------+
| 1 | SIMPLE | o2 | ALL | NULL | NULL | NULL | NULL | 13656 | Using temporary; Using filesort |
+----+-------------+-------+------+---------------+------+---------+------+-------+---------------------------------+


CREATE TABLE `outgoing` (
`id` int(11) unsigned NOT NULL auto_increment,
`type` tinyint(3) unsigned NOT NULL default '1',
`oid` int(11) unsigned NOT NULL default '0',
`date` int(11) NOT NULL default '0',
`receiver` tinyint(3) unsigned NOT NULL default '2',
`comment` text NOT NULL,
`items` mediumint(9) NOT NULL default '0',
`qtt` int(11) NOT NULL default '0',
`value` double(13,5) unsigned NOT NULL default '0.00000',
PRIMARY KEY (`id`),
KEY `date` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2049 ;

CREATE TABLE `outgoing2` (
`oid` int(10) unsigned NOT NULL default '0',
`pos` smallint(5) unsigned NOT NULL auto_increment,
`id` text character set utf8 collate utf8_polish_ci NOT NULL,
`ver` tinyint(3) unsigned NOT NULL default '0',
`subver` tinyint(3) unsigned NOT NULL default '0',
`serials` text NOT NULL,
`qtt` int(10) unsigned NOT NULL default '0',
`price` double(13,5) unsigned NOT NULL default '0.00000',
`did` int(11) unsigned NOT NULL default '0',
`status` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`oid`,`pos`),
KEY `id` (`id`(5),`ver`,`subver`),
KEY `id2` (`id`(5))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Options: ReplyQuote


Subject
Views
Written By
Posted
8010
December 07, 2006 10:30AM
9380
September 23, 2005 01:56AM
4684
October 05, 2005 04:58AM
IT'S A BUG!
5840
October 05, 2005 11:49PM
5181
October 06, 2005 01:34AM
6401
October 06, 2005 04:57PM
6211
January 21, 2008 10:14AM
5632
January 21, 2008 10:53AM
5063
May 19, 2008 09:41AM
5317
February 05, 2008 10:27AM
5797
March 12, 2008 08:37AM
5900
November 14, 2008 12:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.