This repository was archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 128
Make streamId a sql parameter of type SqlDbType.Char #197
Merged
thefringeninja
merged 1 commit into
SQLStreamStore:master
from
olivierpaes:performance-streamid
Oct 26, 2018
Merged
Make streamId a sql parameter of type SqlDbType.Char #197
thefringeninja
merged 1 commit into
SQLStreamStore:master
from
olivierpaes:performance-streamid
Oct 26, 2018
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…onversion is done in MsSql when searching for a stream
thefringeninja
approved these changes
Oct 26, 2018
Contributor
|
Just waiting on CI now... I had b0rked the build but just fixed it |
Contributor
|
Wow, I can't say for sure but it looks like this PR has shaved a few seconds off of the CI build. Thanks! |
Member
|
Great stuff |
Member
|
I'm going to cherry pick this across to a 1.1.3 release branch. |
damianh
added a commit
that referenced
this pull request
Oct 26, 2018
Make streamId a sql parameter of type SqlDbType.Char (cherrypicked from #197)
Member
|
v1.1.3 is now on nuget.org. |
Member
|
@cheesebridge awesome first PR. Many thanks! |
Contributor
|
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). |
Author
|
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. ;-) |
Contributor
|
My bad 😂 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
