Stefano Radaelli
Stefano Radaelli

Reputation: 1118

When to add index in a mysql table?

I have a doubt on create table syntax and more in deep when to create index on it.

More in deep I need to create a table by scratch loading ~1 milion record taken from a CSV.

The question is: when should I create an index on the table? Or better: - Do I have to prefer to use INDEX syntax on CREATE TABLE statement and then fill the table or - Do I have to create table, fill it and then use ALTER TABLE ADD INDEX statement?

Which is faster?

Upvotes: 0

Views: 39

Answers (1)

Meysam PH
Meysam PH

Reputation: 248

It is good to create index after storing data (specially large data).

Creating index before, will burden more overhead on DBMS.

Upvotes: 2

Related Questions