Skip to content
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

With simpler execution plan by avoiding unnecessary sorting of all of… #2115

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Proto.Persistence.SqlServer/SqlServerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public SqlServerProvider(
_sqlReadEvents = $@"SELECT EventIndex, EventData FROM [{_tableSchema}].[{_tableEvents}] WHERE ActorName = @ActorName AND EventIndex >= @IndexStart AND EventIndex <= @IndexEnd ORDER BY EventIndex ASC";

_sqlReadSnapshot =
$@"SELECT TOP 1 SnapshotIndex, SnapshotData FROM [{_tableSchema}].[{_tableSnapshots}] WHERE ActorName = @ActorName ORDER BY SnapshotIndex DESC";
$@"SELECT SnapshotIndex, SnapshotData FROM [{_tableSchema}].[{_tableSnapshots}]
WHERE ActorName = @ActorName AND SnapshotIndex = (SELECT MAX(SnapshotIndex) FROM [{_tableSchema}].[{_tableSnapshots}] WHERE ActorName = @ActorName)";

_sqlSaveEvents =
$@"INSERT INTO [{_tableSchema}].[{_tableEvents}] (Id, ActorName, EventIndex, EventData) VALUES (@Id, @ActorName, @EventIndex, @EventData)";
Expand Down
Loading