Skip to content

feat: add prepared stmt caching#9

Merged
rfberaldo merged 8 commits intomainfrom
feat/stmt
Oct 18, 2025
Merged

feat: add prepared stmt caching#9
rfberaldo merged 8 commits intomainfrom
feat/stmt

Conversation

@rfberaldo
Copy link
Owner

@rfberaldo rfberaldo commented Oct 18, 2025

This adds automatic prepared statement caching, using LRU policy, and a conservative default capacity of 16, effectively per connection.

Can be disabled by setting capacity to zero:

db := sqlz.New(driverName, pool, &sqlz.Options{
  StatementCacheCapacity: 0,
})

Inspired by https://github.com/CAFxX/autoprepare + https://github.com/jackc/pgx

@rfberaldo rfberaldo merged commit 2fabe40 into main Oct 18, 2025
2 checks passed
@rfberaldo rfberaldo deleted the feat/stmt branch October 18, 2025 15:51
Repository owner deleted a comment from codecov-commenter Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant