neisbut / EntityFramework.MemoryJoin

Extension for EntityFramework for joins to in-memory data
MIT License
56 stars 24 forks source link

Identical queries return slightly different sql #28

Open 0Lucifer0 opened 1 year ago

0Lucifer0 commented 1 year ago

Two exactly identical queries running twice are not resolving exactly the same sql because of the interlock increment sequence.

This may cause some Parameter Sniffing issues as things like sql server will cache the query plan base on the text hash so any small change would get cached differently.

cf https://dba.stackexchange.com/questions/291597/parameter-sniffing-and-multiple-plans-in-cache

This is caused by https://github.com/neisbut/EntityFramework.MemoryJoin/blob/master/src/EntityFramework.MemoryJoin/Internal/MappingHelper.cs#L220

Trying to understand why it's here in the first place ? What is this line trying to achieve ? @neisbut

mrbucurie commented 1 year ago

@0Lucifer0 , the increment is needed, otherwise doing 2 joins with the same data source would result in the same query. Please see: https://github.com/neisbut/EntityFramework.MemoryJoin/issues/16

erwan-joly commented 1 year ago

@0Lucifer0 , the increment is needed, otherwise doing 2 joins with the same data source would result in the same query. Please see: #16

Would be nice to be able to disable it then so it doesn't cause massive performance issue for all other query