Home » Performance » MySQL » Improving time for creating indices in MySQL ?
Improving time for creating indices in MySQL ? [message #3676] Wed, 29 October 2008 10:59 Go to next message
afflictedd2  is currently offline afflictedd2
Messages: 4
Registered: July 2008
Location: Texas
Junior Member
Hi guys I have been working on a program that will populate and index a database. The populating doesn't take too long, but the indexing does. My question is: Is there a better approach to indexing this table than the one I'm using right now?

I'm doing this through QtSql.

for (int i = 0; i < headers.size(); ++i) {
q.exec("ALTER TABLE temptable ADD INDEX(" + headers[i] + ");");
}

Thanks in advance,

Ed.
Re: Improving time for creating indices in MySQL ? [message #3698 is a reply to message #3676 ] Tue, 04 November 2008 10:50 Go to previous message
artur8ur  is currently offline artur8ur
Messages: 23
Registered: September 2008
Junior Member
Hi,

create the table with indexes,..
than call:
ALTER table DISABLE KEYS;

Populate the data

Call:
ALTER table ENABLE KEYS;

This should build all indexes in one table scan... (parallel)

With your method a complete table scan has to be done for each index... (serial)

Previous Topic:How to customize Query?
Next Topic:Slow MySQL on idle server
Goto Forum:
  



Current Time: Wed Jan 7 15:38:11 EST 2009

Total time taken to generate the page: 0.00524 seconds
.:: Contact :: Home :: MySQL Support by Percona.com ::.

Powered by: FUDforum 2.7.5.
Copyright ©2001-2006 FUD Forum Bulletin Board Software

MySQL Performance | Forum authority Badge