Reputation: 8865
I have a mysql database. When I enter the data in a table[T_ID, T_Name, T_AGE] (say around 10k rows.) Will the database implicitly create indexes for this table. If so, then what will happen if I create index my-self using "Create Index .. ON say T_ID". Will both the indexes exists or which one will actually be present.
Upvotes: 0
Views: 76
Reputation: 17643
If you specify primary key(t_id)
then it will create automaticaly an index and you won't be able to create another one on the same column.
why you don't try these cases?
Upvotes: 1
Reputation: 29101
It depends on storage engines in MySQL.
In case of InnoDB
storage engine if you don't specify any PRIMARY KEY
on ID
column then internally it will automatically create a clustered index
. see here.
In case of MyISAM
storage engine you can explicitly specify PRIMARY KEY
on ID
field.
Secondary indexes are optional in both the cases.
Upvotes: 0