Do you have any idea on improving MySQL performance when there are 10Million rows & especially when you write join queries between those tables?
Do you have any idea on improving MySQL performance when there are 10Million rows & especially when you write join queries between those tables?
Answers
Add AnswerWould need more info to give you a better answer but to give you a few pointers have a look at indices on the join columns. Tyr join on numberic columns. Also prolly worth having a look at sharding @ a DB level.
create index on query condition
LOAD DATA INFILE
http://blog.chinaunix.net/u/29134/showart_400939.html
Insert the volume of data stored procedure
DELIMITER $$
DROP PROCEDURE IF EXISTS `test`.`sp_insert_batch`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_insert_batch`(IN number int(11))
BEGIN
declare i int(11);
set i = 1;
-- such as 1-2000,2000-4000,....
WHILE i '' then
set @sqltext=concat('insert into song (name,datetime,rank) values',@sqltext);
prepare stmt from @sqltext;
execute stmt;
DEALLOCATE PREPARE stmt;
set @sqltext='';
end if;
END$$
DELIMITER ;
附表结构。
/*DDL Information For - test.song*/
-----------------------------------
Table Create Table
------ ----------------------------------------------------------------------------------------
song CREATE TABLE `song` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Autoincreament element',
`name` text NOT NULL,
`datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`rank` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8102001 DEFAULT CHARSET=gbk
Share your knowledge