View Single Post

   
  #4 (permalink)  
Old 02-28-2008, 10:28 AM
John Nagle
 
Posts: n/a
Default Re: How long does indexing via ALTER TABLE take?

John Nagle wrote:
> Brian Wakem wrote:
>
>> John Nagle wrote:
>>
>>
>>> I loaded about 15 million records into a MySQL table, and
>>> then did an ALTER TABLE to add an index on a BIGINT field.
>>> The ALTER TABLE has been running for about 30 hours now.
>>> About how long should that take?


Apparently MySQL is known to be very slow when "Repair with keycache"
is being used, and it will use that when the MySQL configuration parameters
or the disk space situation prevent sorting. See

http://forums.mysql.com/read.php?21,...6150#msg-86150

MySQL support recommended making

myisam_max_sort_file_size
myisam_max_extra_sort_file_size

large enough to allow a full sort of the database. SHOW VARIABLES gives me

myisam_max_sort_file_size 2147483647

which is only 2GB. There's no value for

myisam_max_extra_sort_file_size

but that didn't do anything anyway and was removed, per

http://bugs.mysql.com/bug.php?id=10163

So apparently I need to restart the server, then, as SUPER,

SET GLOBAL myisam_max_sort_file_size = 30000000000;

then try the ALTER TABLE again. Is that correct?

What's the proper way to shut down the long-running ALTER TABLE
job?

John Nagle
Reply With Quote