I
I
Ivan Melnikov2018-04-16 12:03:18
MySQL
Ivan Melnikov, 2018-04-16 12:03:18

Does it make sense to do an INDEX on a foreign key if the parent table has only 10-1000 records?

The parent table has a primary key of type TINYINT UNSIGNED or SMALLINT UNSIGNED.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Kislenko, 2018-04-16
@webwork

Of course you do. And in general, you need to accustom yourself to search only for those fields on which the index is built. This is a good practice rule. Of course, either action or inaction will not affect performance or disk space, but in order to discipline yourself, this is necessary. This is my opinion based on life experience.

A
Alexander, 2018-04-17
@Tuborg

Surely, your requests will be fulfilled much faster.
You make indexes, foreign keys and selects on them later

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question