-
Notifications
You must be signed in to change notification settings - Fork 26
Translation of enums comparison in filters kills index performance #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The same issue happens when a filtered index is created and such field of type enum is used in the filter condition. SQL Server can't process the WHERE clause and the whole data model provisioning fails:
When the In combination with the fact that any custom indexes are deleted by DataObjects, this is a serious problem when the index is truly necessary for the sake of performance. See also issue #192. |
@ondrejtucny, I made a note that filtered indexes have the same issue, thank you for example of indexes anyway. I did some changes in a separate branch ( |
@ondrejtucny, I have just merged changes to developing version. |
Queries like
have following filter in SQL if
States
has base type smaller thaninteger
, e.g.byte
Such SQL queries have poor performance even if
State
is indexed. This happens because C# compiler elevates left and right expressions up toint
.We could improve this case by applying cast to actual underlying type of
enum
.Note that the problem is also appears in filtered indexes.
The text was updated successfully, but these errors were encountered: