In MySQL, there are different index types, such as a regular INDEX
, a PRIMARY KEY
, or a FULLTEXT
index. You can achieve fast searches with the help of an index. Indexes speed up performance by either ordering the data on disk so it's quicker to find your result or, telling the SQL
engine where to go to find your data.
Example :
Adding indexes to the history table :
ALTER TABLE history ADD INDEX(author(10));
ALTER TABLE history ADD INDEX(title(10));
ALTER TABLE history ADD INDEX(category(5));
ALTER TABLE history ADD INDEX(year);
DESCRIBE history;