dotnet / dotnet/efcore

poor SqliteTransaction perf

Open
#36,386 5 comments 0 reactions 0 assignees View on GitHub
area-adonet-sqlite area-perf consider-for-next-release customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

### Bug description

I'm not a regular sqlite user, but am investigating some perf traces for a component using Microsoft.Data.Sqlite.

I'm seeing ~25% cpu overhead just from recreating/disposing SqliteCommand in Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery
Image

Image

Is it possible to cache the `BEGIN;` and `COMMIT;` commands to avoid this overhead?

### Your code

```csharp
using (var transaction = connection.BeginTransaction())
{
transaction.Commit();
}
```

### Stack traces

```text

```

### Microsoft.Data.Sqlite version

8.0.2

### Target framework

8.0

### Operating system

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.