dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.49k stars 3.13k forks source link

Indexes are created by default for foreign keys in non-relational databases #34053

Closed ajcvickers closed 1 day ago

ajcvickers commented 1 week ago

The convention is debatable even on a relational database, where the use of FKs in joins make this often a useful index to have. Doing it speculatively for non-relational databases seems a step too far.

They are ignored by the Cosmos and in-memory provider, so this should not be breaking.

ErikEJ commented 1 week ago

This seems like quite a breaking change if I understand correctly (I always appreciated that theses indexes were created)

ajcvickers commented 1 week ago

I always appreciated that theses indexes were created

Can you explain more? Neither the Cosmos nor the in-memory provider used the indexes in any way.

ErikEJ commented 1 week ago

So I probably misunderstood - this only affects non-relational providers, you will still create indexes for relational providers?

ajcvickers commented 1 week ago

Yep.

ErikEJ commented 1 week ago

I am just looking at this comment in the PR: "Also stop adding indexes for foreign keys by convention for relational providers." - I think that is what confused / worried me...

ajcvickers commented 1 week ago

Typo in the PR!

ajcvickers commented 2 days ago

Design decision: only remove the convention for Cosmos.