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 ;
Subject
Views
Written By
Posted
27498
August 11, 2005 11:25AM
23620
August 12, 2005 09:07AM
18927
August 12, 2005 01:06PM
18403
August 22, 2005 09:46AM
16491
August 24, 2005 03:27PM
12952
August 24, 2005 04:05PM
13639
August 26, 2005 11:02AM
7419
August 26, 2005 11:05AM
6801
August 26, 2005 11:45AM
6581
August 26, 2005 05:46PM
6848
August 26, 2005 10:34PM
6453
August 25, 2005 01:08PM
5849
August 26, 2005 11:07AM
5650
August 27, 2005 09:09AM
5973
August 29, 2005 11:50AM
5898
August 29, 2005 12:04PM
5255
August 29, 2005 12:55PM
5141
August 29, 2005 05:26PM
5112
August 29, 2005 06:34PM
4743
August 29, 2005 08:40PM
4630
August 29, 2005 08:47PM
4494
August 29, 2005 09:00PM
4691
August 30, 2005 10:05AM
4571
August 30, 2005 10:18AM
5084
August 30, 2005 10:20AM
6097
August 29, 2005 08:53PM
4961
August 29, 2005 09:50PM
4800
August 29, 2005 10:01PM
5239
August 30, 2005 08:53AM
4652
August 30, 2005 11:22AM
5198
August 30, 2005 11:33AM
4863
August 30, 2005 11:59AM
24326
August 31, 2005 02:32PM
6496
August 31, 2005 02:49PM
5180
August 31, 2005 02:56PM
5035
August 31, 2005 03:06PM
8269
December 07, 2006 10:30AM
4975
August 31, 2005 03:10PM
4844
August 31, 2005 03:32PM
17690
August 31, 2005 07:15PM
5089
September 01, 2005 03:05AM
7805
September 15, 2005 04:31PM
5527
September 01, 2005 04:39AM
4431
September 08, 2005 09:53AM
4788
September 08, 2005 11:25AM
4570
September 26, 2005 11:52AM
4479
September 26, 2005 12:13PM
4413
September 27, 2005 09:55AM
4194
September 27, 2005 10:18AM
4088
September 28, 2005 10:29AM
4237
September 28, 2005 10:34AM
4409
September 28, 2005 10:52AM
4874
September 28, 2005 10:58AM
9648
September 23, 2005 01:56AM
4935
September 23, 2005 07:11AM
4908
October 05, 2005 04:58AM
5125
October 05, 2005 04:52PM
IT'S A BUG!
6114
October 05, 2005 11:49PM
5377
October 06, 2005 01:34AM
6691
October 06, 2005 04:57PM
4624
December 13, 2005 10:28AM
4613
December 13, 2005 10:34AM
4519
November 17, 2005 09:39AM
4883
January 08, 2007 12:12PM
4750
December 12, 2005 02:13PM
4599
December 14, 2005 11:43PM
4193
December 15, 2005 08:37AM
4263
December 15, 2005 11:18AM
4177
December 15, 2005 11:27AM
4296
December 15, 2005 11:32AM
4049
December 15, 2005 11:43AM
4006
December 15, 2005 11:43AM
4179
December 15, 2005 11:48AM
4069
December 15, 2005 11:51AM
4463
December 15, 2005 02:14PM
4116
December 15, 2005 02:18PM
3984
December 15, 2005 02:27PM
4490
December 15, 2005 02:43PM
4032
December 15, 2005 08:46AM
5019
January 26, 2006 12:38PM
4142
January 26, 2006 01:48PM
4222
January 26, 2006 01:48PM
4004
January 26, 2006 01:52PM
4148
January 27, 2006 04:46PM
4026
January 29, 2006 11:21AM
4364
January 30, 2006 09:42AM
4397
February 27, 2006 02:17PM
4083
February 27, 2006 02:23PM
4312
March 05, 2006 04:56AM
4131
March 06, 2006 08:09AM
4098
April 05, 2006 01:03PM
4279
September 27, 2006 08:43AM
4233
November 19, 2006 04:42AM
4384
December 14, 2006 05:45PM
4202
February 01, 2007 04:40AM
4871
November 11, 2007 01:24PM
5079
December 20, 2007 10:40AM
6513
January 21, 2008 10:14AM
5854
January 21, 2008 10:53AM
5315
May 19, 2008 09:41AM
5527
February 05, 2008 10:27AM
6069
March 12, 2008 08:37AM
5388
May 19, 2008 03:02AM
6127
November 14, 2008 12:31AM
7138
March 06, 2009 03:36PM