dotnet / dotnet/EntityFramework.Docs
Guide users to consider adding an index on their TPH discriminator column
Open
area-perf
- Dominant language
- Mermaid
- Stars
- 1.7k
- Forks
- 2k
- Avg merge
- 7d 23h
- Merged PRs (30d)
- 16
Description
We don't automatically create an index on the discriminator, since that doesn't necessarily make sense in all cases (https://github.com/dotnet/efcore/issues/4030).
However, we should make users aware of this, and discuss when they might want to do this.
Note: for SQL Server specifically, it may make sense to make the index clustered. SQL Server prefers table scans to using non-clustered indexes which aren't highly selective, and discriminator value cardinality is generally low, so low selectivity (see https://stackoverflow.com/a/17861246/640325).
Contributor guide
Assessment
This issue has not been assessed yet.