[CONJ-998] Question regarding useServerPrepStmts documentation Created: 2022-08-15 Updated: 2023-12-13 |
|
| Status: | Open |
| Project: | MariaDB Connector/J |
| Component/s: | documentation |
| Affects Version/s: | 3.0.7 |
| Fix Version/s: | 3.0 |
| Type: | Task | Priority: | Minor |
| Reporter: | laurent perez | Assignee: | Diego Dupin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | documentation | ||
| Issue Links: |
|
||||
| Description |
|
Hello I'm migrating from mysql connector J to mariadb connector J.
My question is : why is the general case documented as set to use the direct command ? AFAIU binary protocol is better because it has less overhead and execution benefits from a cached execution plan. There is also a safe upper limit of 8192 bytes (on the connector side when clientPrepStmts are used) so cached ones do not add much memory usage. Of course preparing triggers a prepare & execute instead of a raw query. I'm not sure it may alter performances. Or is the text protocol just "safer" or "better" ? Is it to avoid cache misshits ? Thanks |
| Comments |
| Comment by Diego Dupin [ 2022-08-16 ] |
|
Text is a globaly a safe default behavior. Always working without issue. Binary protocol has usually good benefits, but that depends:
This is totally depending on queries, but here is some numbers i usually see when benchmarking, in order to explain:
Now there is 2 others thing to consider :
So, if you use a MariaDB server version 10.6, and application doesn't execute completly differents queries, binary protocol (option 'useServerPrepStmts') is recommended. So, yes good you ask, documentation has to be improved. |
| Comment by laurent perez [ 2022-08-16 ] |
|
Thanks a lot this is a very good and detailed explanation ! |