Today I am testing part of mysql cluster. During the test, I queried tables with the same structure in the two systems, and the results were unexpected.
The script is as follows:
DROP TABLE IF EXISTS urllog;
CREATE TABLE urllog(
ID int(11) NOT NULL auto_increment,
url varchar(435) NOT NULL default '',
create_time datetime NOT NULL,
PRIMARY KEY (ID)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=utf8;
I originally had 400,000 data on the sql server, and imported 320,000 data into mysql. The query results were:
select url,count(*) cnt from urllog group by url order by cnt limit 10
query time: 9 minutes
select top 10 url,count(*) cnt from urllog group by url order by cnt
query time: 22 seconds