Skip to content

Conversation

@Neurostep
Copy link
Contributor

@Neurostep Neurostep commented Nov 26, 2025

Description

In this PR we are extending the Database configuration settings. Those configuration settings may help improving performance of the SQL operations in certain cases.

  • DisableDefaultGormTransaction
    GORM performs write (create/update/delete) operations inside a transaction to ensure data consistency, which is bad for performance. It can be disabled with this setting to true

  • CachePreparedStatements
    If set to true, creates a prepared statement when executing any SQL and caches them to speed up future calls.

  • MysqlInterpolateParams
    If set to true, placeholders (?) in calls to db.Query() and db.Exec() are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with interpolateParams=false.

Checklist

  • Prefixed the PR title with the JIRA ticket code
  • Performed simple, atomic commits with good commit messages
  • Verified that the commit history is linear and commits are squashed as necessary
  • Thoroughly tested the changes in development and/or staging
  • Updated the README.md as necessary

Related links


Note

Adds new DB performance settings and applies them to GORM (transactions/prepared statements) and MySQL DSN (interpolateParams), with tests and docs updated.

  • Database:
    • Config (pkg/database/config.go): Add disable_default_gorm_transaction, cache_prepared_statements, mysql_interpolate_params.
    • Connection details (pkg/database/connection_details.go): Pass mysql_interpolate_params; include interpolateParams=true in DSN opts when enabled.
    • GORM init (pkg/database/gorm.go): Respect DisableDefaultGormTransaction (SkipDefaultTransaction) and CachePreparedStatements (PrepareStmt).
  • Tests:
    • Update config_test.go and connection_details_test.go to assert new config fields and DSN option.
  • Docs:
    • Expand README database settings table with the new options.

Written by Cursor Bugbot for commit 9dc579b. This will update automatically on new commits. Configure here.

@Neurostep Neurostep requested a review from a team as a code owner November 26, 2025 11:40
@Neurostep Neurostep force-pushed the maksimt/DEVPLAT-6367/db-oerf-config branch from 83fbe37 to 58cc5f0 Compare November 26, 2025 14:18
terranisu
terranisu previously approved these changes Nov 26, 2025
Copy link
Member

@terranisu terranisu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks exposed to me

@Neurostep Neurostep merged commit c03535b into main Nov 28, 2025
6 checks passed
@Neurostep Neurostep deleted the maksimt/DEVPLAT-6367/db-oerf-config branch November 28, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants