EntityFramework.MemoryJoin icon indicating copy to clipboard operation
EntityFramework.MemoryJoin copied to clipboard

Identical queries return slightly different sql

Open 0Lucifer0 opened this issue 2 years ago • 2 comments

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

0Lucifer0 avatar Sep 21 '22 22:09 0Lucifer0

@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

mrbucurie avatar Jan 11 '23 11:01 mrbucurie

@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

erwan-joly avatar Jan 30 '23 01:01 erwan-joly