sum and count
Hi,
I have this table (with 978000 rows):
CREATE TABLE `graph`.`edge_1` (
`uid` int(10) unsigned NOT NULL default '0',
`vid` int(10) unsigned NOT NULL default '0',
`rid` int(10) unsigned NOT NULL default '0',
`count` int(10) unsigned NOT NULL default '1',
PRIMARY KEY (`uid`,`vid`,`rid`),
KEY `FK_Edge_1` (`rid`),
KEY `FK_Edge_4` (`vid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
And i have to execute this query:
"SELECT vid,sum(`count`) FROM edge_1 e group by vid;"
which takes 224 Seconds to finish!!
now i need to do it in a faster way!! How? any ideas?
One more thing executing the following query:
"SELECT vid,sum(`count`) FROM edge_1 e group by vid;"
takes 16 seconds only!!!!
Why is that?? is Sum() slower than count()? of course slower but that much!!
Subject
Views
Written By
Posted
sum and count
6758
June 03, 2008 05:40PM
2196
June 07, 2008 08:47AM
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.