Skip to content

Commit

Permalink
[startup optimization] IndexStore: Check if table is empty faster (#…
Browse files Browse the repository at this point in the history
…11718)

(cherry picked from commit 6c67767)
  • Loading branch information
kiminuo authored and adamPetho committed Nov 28, 2023
1 parent 9a598ed commit 7ce372d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WalletWasabi/Stores/BlockFilterSqliteStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public static BlockFilterSqliteStorage FromFile(string dataSource, FilterModel?
if (startingFilter is not null)
{
using SqliteCommand isEmptyCommand = connection.CreateCommand();
isEmptyCommand.CommandText = "SELECT COUNT(*) FROM filter";
int count = Convert.ToInt32(isEmptyCommand.ExecuteScalar());
isEmptyCommand.CommandText = "SELECT EXISTS (SELECT 1 FROM filter)";
int existRows = Convert.ToInt32(isEmptyCommand.ExecuteScalar());

if (count == 0)
if (existRows == 0)
{
if (!storage.TryAppend(startingFilter))
{
Expand Down

0 comments on commit 7ce372d

Please sign in to comment.