简体   繁体   中英

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?

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

Creating index before, will burden more overhead on DBMS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM