Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Foreign key in one table have high read performance or another table with two primary key?

$
0
0

I want to know witch one is better for high read performance. Foreign key in one table have high read performance or another table with two primary key?

In Figure1 "idFactor" is nullable some Sanads come without Factor

Q1- For example I want to list all Sanads Factor or Find is there any Factor for special Sanad.

Q2- Which one is better if "idFactor" can not be null.

Figure1

Table Factor:

idFactor //Primary key
field1
field2

Table Sanad:

idSanad //Primary key
field1
field2
idFactor // Foreign key (Nullable)

OR

Figure 2

Table Factor:

idFactor //Primary key
field1
field2

Table Sanad:

idSanad //Primary key
field1
field2

Table FactorSanad:

idSanad //Primary key - Foreign key
idFactor //Primary key - Foreign key

Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>