You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT [n].[Name] AS [Name1], [t0].[PhoneNumber]
FROM [Name] AS [n]
INNER JOIN (
SELECT [t].[Id], [t].[Deleted], [t].[NameId], [t].[PhoneNumber]
FROM [Telephone] AS [t]
WHERE [t].[Deleted] <> CAST(1ASbit)
) AS [t0] ON [n].[Id] = [t0].[NameId]
Whereas the optimal query would be
SELECT [n].[Name] AS [Name1], [t0].[PhoneNumber]
FROM [Name] AS [n]
INNER JOIN [Telephone] AS [t0] ON [n].[Id] = [t0].[NameId] and [t0].[Deleted] <> CAST(1ASbit)
Any suggestions on what I may be doing wrong or how to optimise the query generation
Thanks in advance
The text was updated successfully, but these errors were encountered:
Not only that, but if you try and use full text indexing functions like Contains or FreeText it failes since it tried to do them on the sub query.
SELECT [n].[Name] AS [Name1], [t0].[PhoneNumber]
FROM [Name] AS [n]
INNER JOIN (
SELECT [t].[Id], [t].[Deleted], [t].[NameId], [t].[PhoneNumber]
FROM [Telephone] AS [t]
WHERE [t].[Deleted] <> CAST(1 AS bit)
) AS [t0] ON [n].[Id] = [t0].[NameId]
WHERE Contains('PhoneNumber', '"something")
EFCore 3.1.4
When using dynamic query filters and joins the sql generated uses subqueries for each table joined causing slow query executing on large data tables.
Produces sql statement
Whereas the optimal query would be
Any suggestions on what I may be doing wrong or how to optimise the query generation
Thanks in advance
The text was updated successfully, but these errors were encountered: