Home » Performance » MySQL » large table - index creation
large table - index creation [message #2226] Tue, 20 November 2007 11:13 Go to next message
andyr  is currently offline andyr
Messages: 1
Registered: November 2007
Location: Ithaca, NY
Junior Member
Hi,
I am running MYSQL version 5.0.24 and have a table with over 100 million records. A slimmed down version of the InnoDB table looks like the following:

Individual_id varchar(10),
Family_id varchar(10),
Value varchar(100)

The goal was to create a table that could be used to generate a list of values by individual and by family id. So, each of the following queries would produce the list of values that I’m looking for.

select group_concat(value)
from table
group by individual_id

example: individual1, value1, value2, value3,….,valueN

select group_concat(value)
from table
group by family_id

example: family1, value1, value2, value3,….,valueN


I’ve imported all the data but it is taking a very long time to create indexes on the Individual_id and Family_id columns. Individual_id has a cardinality of 20,000 while family_id has a cardinality of ~ 4000. The index creation has been running for over 4 hours. Can anyone suggest a more efficient way to approach the problem of index creation? In hindsight, I probably would have converted the individual_id and family_id to an integer value? I’m wondering if I should cut my losses and make that switch before creating the indexes?

Thanks in advance.
Re: large table - index creation [message #2251 is a reply to message #2226 ] Thu, 22 November 2007 16:37 Go to previous messageGo to next message
mikec  is currently offline mikec
Messages: 22
Registered: September 2007
Junior Member
Are these Innodb tables or MyISAM tables?

If MyISAM do a "show processlist" and see if the
MySQL thread is stuck doing a "repair with keycache". It should
be doing a "repair with filesort" instead. Make sure you have
key_buffer size big enough to get around this.
Re: large table - index creation [message #2252 is a reply to message #2251 ] Thu, 22 November 2007 16:44 Go to previous messageGo to next message
mikec  is currently offline mikec
Messages: 22
Registered: September 2007
Junior Member
I missed that you said they were Innodb tables...

Maybe make the innodb_buffer_size and sort_buffer_size
as big as possible and should help a lot. You can
set the sort_buffer_size dynamically.

SET sort_buffer_size=1000000
Re: large table - index creation [message #2256 is a reply to message #2251 ] Thu, 22 November 2007 20:22 Go to previous message
mikec  is currently offline mikec
Messages: 22
Registered: September 2007
Junior Member
slight correction...f MyISAM, make sure myisam_sort_buffer
is also big.
Previous Topic:Clustered index decision in a large table
Next Topic:mysql TABLE optimisation
Goto Forum:
  


Current Time: Fri Jul 10 03:46:43 EDT 2009

Total time taken to generate the page: 0.10835 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.