-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
Generating auto-queries can be expensive since reflection is used to walk over the types and generate SQL. The SQL itself can become quite large so there's a lot of appending to StringBuilders happening, which will obviously cause allocations and copying.
It would be better to cache auto-queries based on criteria such as:
- The types involved
- Parameter names
- WHERE clause content and split on columns for custom WHERE clauses
You don't need to cache anything for calls to CustomQuery because Dapper will cache the queries itself. With AutoQueries this is just a way of avoiding large amounts of SQL generation for frequently repeated queries, which should noticeably improve performance under load.
Reactions are currently unavailable