0

I have dbContext context and tables t1 and t2. Is it possible so specify join hint in

context.t1.Join(context.t2, ...) ?

Like

... FROM t1
INNER MERGE JOIN t2 ...

in TSQL

user2820173
  • 308
  • 2
  • 13
  • Why do you think you need use a join hint? That is telling the sql engine that you know better than the optimizer how to join tables. – Sean Lange Jan 24 '19 at 14:20
  • Yes. See msdn : https://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b – jdweng Jan 24 '19 at 14:20
  • @SeanLange, I'm not sure why, but optimizer very often chooses loop join, which performs very poorly, when there are lots of rows. – user2820173 Jan 24 '19 at 14:26
  • @jdweng, I didn't notice any mention of how to specify loop/merge/hash join. Did I miss it? – user2820173 Jan 24 '19 at 14:27
  • A hash is a .ToDictionary(). A merge is a JOIN. Why do you want to loop? A select enumerates through a list. – jdweng Jan 24 '19 at 14:47
  • Check out [this answer](https://stackoverflow.com/a/3038742/5308054). But if you want to use low level advantages of SQL Server why not to use ADO instead of EF? – Dzmitry Paliakou Jan 25 '19 at 13:25

0 Answers0