这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@vadimberezniker
Copy link
Member

@vadimberezniker vadimberezniker commented Jun 11, 2024

Turns out it was the MySQL driver that was falling back to prepared statements, not GORM.
If the MySQL driver received a query with arguments, it forced the caller to use a prepare/execute combination which requires two round trips. MySQL has an option called 'interpolateParams' that does the interpolation client side in the driver instead of relying on the server.

Related issues: N/A

Currently all queries require at least 2 round trips because
each query uses a prepared statement and prepared statements are never
reused.
Copy link
Member

@tylerwilliams tylerwilliams left a comment

Choose a reason for hiding this comment

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

cool :)

@vadimberezniker vadimberezniker changed the title Enable prepared statement caching. Enable mysql query interpolation. Jun 12, 2024
@vadimberezniker vadimberezniker merged commit e5dedc5 into master Jun 12, 2024
@vadimberezniker vadimberezniker deleted the prepared_caching branch June 12, 2024 00:42
maggie-lou pushed a commit that referenced this pull request Jun 13, 2024
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.

3 participants