-
Notifications
You must be signed in to change notification settings - Fork 124
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
Make streamId a sql parameter of type SqlDbType.Char #197
Make streamId a sql parameter of type SqlDbType.Char #197
Conversation
…onversion is done in MsSql when searching for a stream
Just waiting on CI now... I had b0rked the build but just fixed it |
Wow, I can't say for sure but it looks like this PR has shaved a few seconds off of the CI build. Thanks! |
Great stuff |
I'm going to cherry pick this across to a 1.1.3 release branch. |
Make streamId a sql parameter of type SqlDbType.Char (cherrypicked from #197)
v1.1.3 is now on nuget.org. |
@cheesebridge awesome first PR. Many thanks! |
Good stuff! Not sure we can improve on this but Index Scan is generally not a good thing - we should strive for Index Seeks (but as said, I don't know whether that is possible here). |
You're welcome. It's a great product 👍 @yreynhout Well this PR turns the index scan into an index seek as you can see in the 'after' screenshot of the query execution plan. ;-) |
My bad 😂 |
In our project we saw serious performance issues when having millions of streams.
This issue was caused by a CONVERT_IMPLICIT() function that was always executed when searching streams by streamId.
Our streamId was a regular Guid and the parameter type got translated to a nvarchar(36)
The result was an index scan on the streams table instead of an index seek.
In this PR, all streamId parameters are typed as SqlDbType.Char with length 42 because the streamid column on the streams table is declared as CHAR(42).
Now an index seek can be done.
Before
After