Should a foreign key table lookup always be indexed?

If I have a lookup table with a very small number of entries in it (say, less than ten), should I put a pointer to the foreign key of another table to which it is attached? In this case, does the lookup table even need an index on the Primary Key?

In particular, is there a performance advantage that outweighs the overhead of maintaining indexes? If not, are there any benefits besides speed?

Note: an example of a lookup table might be order status, where tuples are:

1 - Order Received
2 - In Process
3 - Shipped
4 - Paid
+3
source share
5 answers

(, ), , , . , . FK . .

, FK FK , , I/O, .

, - - , .

, (, ), , , . , FK , - .

, SQL Server. (.. , , ), " ", , .

, , . , - .

, Oracle, , SQL Server . , - SQL Server.

+5

, .

() , : (1) , (2) .

( ) " " .

+5

, ... , , . . - .

+3

. .

:

  • FK
  • , ? ...

, , .

OLTP- (5 + ) . FK, . , /, .

dmvs SQL Server 2005, , . FK.

+3

sql- - , ( ).

0

Source: https://habr.com/ru/post/1711105/


All Articles