1

i have innodb tables (all of them are in the same file, and this file became very large, about 8GB) when i insert a row in one this table (this table contains about 1 million record), this insert statement takes about 30 seconds !!! is there anyway to improve this issue?? any idea is highly appreciated

CREATE TABLE userdata ( userno blob NOT NULL, amount double(11,2), active enum('0','1') default '0', used enum('0','1') default '0', ActionTime timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, Bonus enum('0','1') default '0', UserType enum('Perm','Temp') NOT NULL default 'Perm', serial_number bigint(20) NOT NULL default '0', PRIMARY KEY (userno(50)), KEY AIX (active), KEY UIX (used), KEY Id (userno(20),active), KEY UI (userno(50)), KEY SNI (serial_number) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 
5
  • 3
    Сould you please post the table's definition? Are there indexes, foreign key constraints and triggers on the table? Please run SHOW CREATE TABLE mytable and post its output. Commented Nov 2, 2010 at 10:29
  • 1
    Also look at Hardware part. Can you try increasing the RAM? are there any other CPU intensive processes running the server? If so, can you move these CPU intensive processes onto another server? How many users are currently accessing the DB? Commented Nov 2, 2010 at 10:43
  • 2
    And pick our grandmother up from the airport. Commented Nov 2, 2010 at 10:50
  • CREATE TABLE userdata ( userno blob NOT NULL, amount double(11,2), active enum('0','1') default '0', used enum('0','1') default '0', ActionTime timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, Bonus enum('0','1') default '0', UserType enum('Perm','Temp') NOT NULL default 'Perm', serial_number bigint(20) NOT NULL default '0', PRIMARY KEY (userno(50)), KEY AIX (active), KEY UIX (used), KEY Id (userno(20),active), KEY UI (userno(50)), KEY SNI (serial_number) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 Commented Nov 2, 2010 at 10:55
  • And how big is a typical userno? Commented Nov 2, 2010 at 12:14

1 Answer 1

1

Having BLOB as a PRIMARY KEY is not the best idea.

Could you change its datatype to INT?

Sign up to request clarification or add additional context in comments.

3 Comments

i think so,,,, i am trying to get as much ideas as possible
i got involved in this system and i have to fix this problem
I feel your pain, you should have run when you had the chance:-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.