Is it required to use index when the MySQL table has only 100 rows? Justify your answer.

Hi,Index is used to speed up query.If particular column is used often in queries and table has lot of data.Then it is recommended to create index for that column of the table. It will speed up the query.

In addition, check the documentation:


Indexes are less important for queries on small tables, or big tables where report queries process most or all of the rows. When a query needs to access most of the rows, reading sequentially is faster than working through an index. Sequential reads minimize disk seeks, even if not all the rows are needed for the query.

Anyway it's the query optimizer that will decide if the query will use the available indexes or not, you can force it to use a specific index or to ignore them all, read these links for more information:

So, at end, test your queries, use the explain select ... and see when you get better results.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.