Home » Performance » MySQL » building new index on big tables
building new index on big tables [message #423] Fri, 24 November 2006 16:53 Go to next message
rds13  is currently offline rds13
Messages: 1
Registered: November 2006
Junior Member
Hye,

We have tables with over 10 or 20 millions of records (MyISAM tables if that matters).
Building new index, removing old index is taking at least a quarter of hour.
While doing this operation, MySQL seems to lock the table or at least the load is so big that any operations on the table is delayed after the end of index operation.

I wonder how DBA usually deal with this kind of problem on MySQL ?

I cannot imagine a strategy which would help keeping the service a hundred per cent available while achieving an index reconfiguration.
Re: building new index on big tables [message #424 is a reply to message #423 ] Fri, 24 November 2006 17:32 Go to previous messageGo to next message
bitrockers  is currently offline bitrockers
Messages: 11
Registered: November 2006
Location: Germany
Junior Member

Hi,

I guess there's no real solution for that problem. We're having the same problem on our database (also 10/20 millions records per table).

If you can afford to stop your service while you're generating the indexes, you should try stopping the server, change my.cnf's parameters for best memory usage on creating indexes, alter the index, and than undo your change and start mysql again. I'm not sure what would be the best parameters to speed up index generation in mysql, but I guess you should try to increase myisam_sort_buffer_size?

Maybe Peter can help you more with that. Smile

Greetings
Christian
Re: building new index on big tables [message #429 is a reply to message #424 ] Mon, 27 November 2006 12:30 Go to previous message
Peter  is currently offline Peter
Messages: 405
Registered: August 2006
Senior Member
Super Guru
Right,

This is surely the problem with MySQL operations.

There are two tricks which I use to make large index creation in MySQL less painful (or any alter table for that matter)

1) Using smaller tables with data spread across them. It works for some application it does not for others.

2) Use two MySQL servers in Master-Master Active-Passive configuration and perform "upgrade" on the slave then switch the roles and repeate.

Sometimes you can also make things read-only and copy stuff in new table of appropriate structure instead of runnin ALTER TABLE


Peter Zaitsev, MySQL Performance Expert
MySQL Performance Blog - http://www.mysqlperformanceblog.com
MySQL Consulting http://www.mysqlperformanceblog.com/mysql-consulting/
Previous Topic:Normal for mysql to strip trailing spaces?
Next Topic:Creating The right database for hundreds of thousands of Blog Posts?
Goto Forum:
  


Current Time: Fri Jul 10 02:40:37 EDT 2009

Total time taken to generate the page: 0.01748 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.