DapperLib / DapperLib/Dapper

Dapper doesn't use prepared statements

Open
#474 14 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v3.0
Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

In most RDBMS that could be replaced by stored procedures, but SQLite doesn't have them. If I need to insert many rows, but cannot do so in a single transaction, I cannot reuse prepared statements. Please see this issue for additional details. In this test using Dapper is now c.25% slower than the manual call.

One idea is to cache queries by sql string, make them prepared, and just populate parameters on every subsequent call. That could be done with some additional overload with an optional parameter prepared = false. Are you interested in supporting this?

Dapper is awesome for automatic mapping, it will be even more awesome and faster with support of prepared statements!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked SQLite performance test and the referenced Microsoft.Data.Sqlite issue to understand the reported comparison and constraints. Trace Dapper's command execution and query-caching paths before deciding how prepared statements would be reused. Done means repeated calls can reuse prepared statements without breaking existing parameter handling or behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql, sqlite
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.