RemarkLima
RemarkLima

Reputation: 12037

Entity Framework Core - "The query processor ran out of internal resources" error only using EF, executing SQL server and get the results

Using Entity Framework Core 2.0, I have a set of queries to produce a result and it works flawlessly...

Except, for one specific query using EF .where() statements to build up the query, this and it throw's "The query processor ran out of internal resources and could not produce a query plan".

I've output the produces SQL and used SQL profiler - and executing the exact query in SQL Server (2016) takes less than one second, so I'm at a bit of a loss of how to diagnose this any further...

What would be the next steps to diagnose this error?

Upvotes: 0

Views: 4233

Answers (1)

nbrosz
nbrosz

Reputation: 924

Try breaking your query up into smaller pieces, as Microsoft suggests. Some possibilities might include taking vertical slices of your data using Skip and Take and handling them one at a time. Another option would be to bring your query in-memory with a .ToArray() call before your .Where(), so it won't be SQL handling that complex query, but your machine.

Upvotes: 1

Related Questions