shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Prepared statements caching in proxy

Open TedCraft opened this issue 1 year ago • 3 comments

Feature Request

For English only, other languages will not be accepted.

Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot make decision by current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Is your feature request related to a problem?

In MySQL and PostgreSQL, reused prepared statements are managed efficiently through the internal JDBC driver cache. However, the Firebird JDBC driver lacks this caching capability. As a result, when a user executes a prepared statement multiple times, ShardingSphere repeatedly performs the costly 'prepare' operation, rather than executing it just once using a cached statement.

Describe the feature you would like.

I propose adding a caching mechanism for prepared statements in the proxy, similar to how it is implemented in the JDBC driver. I currently have the necessary changes in my fork, but before creating a pull request, I would like to hear the community's opinion on this feature. My implementation modifies some of the core proxy code (though it does not affect the execution logic for MySQL and PostgreSQL) and might not be strictly necessary for databases that already have client-side caching in their drivers. However, in the future, this may be useful for databases without this built-in feature.

TedCraft avatar Dec 03 '25 21:12 TedCraft

I would like to solve the issue, please assign me

aviralgarg05 avatar Jan 17 '26 13:01 aviralgarg05

I would like to solve the issue, please assign me

@terrymanu

aviralgarg05 avatar Feb 18 '26 06:02 aviralgarg05

I am willing to resolve this issue and my plan is to implement a connection-level LRU cache context to implement a caching mechanism for prepared statements. Could you please assign me?

AsyncKurisu avatar Apr 20 '26 05:04 AsyncKurisu