dotnet / dotnet/efcore

Look into IS DISTINCT FROM as an alternative to our current null compensation scheme

Open
#29,624 11 comments 4 reactions 0 assignees View on GitHub
area-perf area-query needs-design
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

SQL Server 2022 has support for IS [NOT] DISTINCT FROM ([docs](https://learn.microsoft.com/en-us/sql/t-sql/queries/is-distinct-from-transact-sql?view=sql-server-ver16)); this is an equality check that treats two nulls as equal (similar to how DISTINCT works in SQL queries).

PostgreSQL has had this for a long time ([docs](https://www.postgresql.org/docs/current/functions-comparison.html)), but last time I checked it didn't utilize indexes. If the SQL Server version does, then we can use this as a terser alternative to the equality operator, which doesn't require null compensation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.