feat: cache prepare statement for reuse#1496
Conversation
|
Do not merge until all tests are passing: The root cause of the "random" packet size limit errors. Is caused by the |
|
This will also try to store the preparations for any call statements, right? When trying out a different way to deal with that, we encountered issues with that, as some built-in procedures like setting application locks will only be executable once. |
|
Good to know that there are these special procedure. There are similar problems with queries that want to stream their results. They would block the prepared statement for an extended period of time. Therefor in this PR I had added the ability to "detach" a prepared statement (code). Which means that the |
Currently
@cap-js/hanawill always callpreparefor queries that have placeholders?. With this PR theSQLstatement is used as a cache key preventingpreparefrom being called. Allowing already prepared statements to be run directly. Reducing the amount of round trips. It is not allowed to runSELECTstatements instatement.runBatch. Therefor it is not possible to use the event loop as an arguments collection mechanism to further reduce network overhead. As the HANA connection is (currently) only capable of having a single packed in flight there is no possibility that performance will be worsened by having statement executions be queued on the cached prepared statement.There is a special case for streaming queries (incl. blob streams for
@sap/hana-client). It is not possible to determine when the preparedstatementis no longer required. Therefor the prepared statements for streaming queries are detached from the cache once initiated.