Hi,
i am using mysql version 4.1 and there is a table having 2.5 million
records , the table structure is given below.. if i run above select
query time taken is 19.33 sec
I have some Questions:
1. Is this acceptable time in terms of mysql? (For me its not)
2. How can i reduce this time so that to increase performance?
I have tried multicolumn indexing but it didnt helped.currentl y i am using
indexing over name . The time is proportional to number of records fetched .
Explain results:
Table structure:
please suggest me how i can reduce the query time.
Thanks In Advance.....
Code:
select c19,name,c5,count(*) as count,sum(c13) as cost from TableA where c1 like '%' and c5 like '%' and name like 'bravo' and c19 between '2009-01-01 00:00:00' and '2012-01-01 00:00:00' group by date(c19),name,c5 limit 10000 offset 0
records , the table structure is given below.. if i run above select
query time taken is 19.33 sec
I have some Questions:
1. Is this acceptable time in terms of mysql? (For me its not)
2. How can i reduce this time so that to increase performance?
I have tried multicolumn indexing but it didnt helped.currentl y i am using
indexing over name . The time is proportional to number of records fetched .
Explain results:
----------------------------------------------------------------------------------------------------------------------------------------------------
id | select_type | table | type | possible_keys | key | key_len | ref | rows |Extra
---------------------------------------------------------------------------------------------------------------------------------------------------
1 | SIMPLE | TableA | range| name | name | 15 | NULL | 256903 | Using where; Using temporary; Using filesort
----------------------------------------------------------------------------------------------------------------------------------------------------
id | select_type | table | type | possible_keys | key | key_len | ref | rows |Extra
---------------------------------------------------------------------------------------------------------------------------------------------------
1 | SIMPLE | TableA | range| name | name | 15 | NULL | 256903 | Using where; Using temporary; Using filesort
----------------------------------------------------------------------------------------------------------------------------------------------------
Code:
CREATE TABLE TableA ( msg_id varchar(20) NOT NULL default '', name varchar(15) NOT NULL default '', c1 varchar(50) NOT NULL default '', c2 varchar(15) default NULL, c3 varchar(15) default NULL, c4 tinyint(3) unsigned NOT NULL default '0', c5 tinyint(3) unsigned NOT NULL default '0', c6 varchar(15) default NULL, c7 tinyint(3) unsigned NOT NULL default '0', c8 tinyint(3) unsigned NOT NULL default '0', c9 tinyint(3) unsigned NOT NULL default '0', c10 tinyint(3) unsigned NOT NULL default '0', c11 tinyint(3) unsigned NOT NULL default '0', c12 tinyint(3) unsigned NOT NULL default '0', c13 decimal(12,5) NOT NULL default '0.00000', c14 varchar(15) NOT NULL default '', c15 int(5) unsigned default '0', c16 int(5) unsigned default '0', c17 varchar(20) NOT NULL default '', c18 tinyint(3) unsigned default '0', c19 varchar(50) NOT NULL default '0000-00-00 00:00:00', c20 datetime NOT NULL default '0000-00-00 00:00:00', c21 varchar(15) default 'PENDING', c22 int(3) unsigned default '0', c23 varchar(5) NOT NULL default 'false', PRIMARY KEY (msg_id), KEY uname (username) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Thanks In Advance.....
Comment