Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Using non-const string query performance #134

Open
ttermeer-reboundcg opened this issue Nov 6, 2024 · 0 comments
Open

Using non-const string query performance #134

ttermeer-reboundcg opened this issue Nov 6, 2024 · 0 comments

Comments

@ttermeer-reboundcg
Copy link

There seems to be a big performance hit in DapperAOT when using locally built string as a query.

Example:
Bad performance

string sql = "SELECT * FROM table1"
connection.Query(sql);

Good

const string sql = "SELECT * FROM table1"
connection.Query(sql);

This does not happen with Dapper.
The performance hit can be quite big for lengthy queries that are heavily repeated - like doing a transaction with 10k update queries. We noticed query being 5 times slower.
While using const string can be a solution in some case, it becomes an issue when the query need to be assembled at runtime based on different parameters (like for filters)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant