Question Details

Browse

How to increase performance?

By onlinedhandu - Oct. 03, 2008

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 Answer
  1. By moochie on Oct. 04, 2008

    Would 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.


    0 Votes
  2. By jkman on Oct. 16, 2008

    create index on query condition


    0 Votes
  3. By so8610 on Oct. 16, 2008

    LOAD DATA INFILE


    http://blog.chinaunix.net/u/29134/showart_400939.html


    0 Votes
  4. By so8610 on Oct. 17, 2008

    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


    0 Votes
Share your knowledge