MySQL - how long to create an index?

Posted by user293594 on Stack Overflow See other posts from Stack Overflow or by user293594
Published on 2010-03-20T13:35:56Z Indexed on 2010/03/20 13:41 UTC
Read the original article Hit count: 328

Filed under:
|

Can anyone tell me how adding a key scales in MySQL? I have 500,000,000 rows in a database, trans, with columns i (INT UNSIGNED), j (INT UNSIGNED), nu (DOUBLE), A (DOUBLE). I try to index a column, e.g.

ALTER TABLE trans ADD KEY idx_A (A);

and I wait. For a table of 14,000,000 rows it took about 2 minutes to execute on my MacBook Pro, but for the whole half a billion, it's taking 15hrs and counting. Am I doing something wrong, or am I just being naive about how indexing a database scales with the number of rows?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about index