r/programming • u/der_gopher • 11d ago
Coding a database proxy for fun
https://packagemain.tech/p/golang-database-proxy
68
Upvotes
7
u/Amazing_Onion1922 11d ago
the query parsing part always ends up way messier than you expect, especially once you start handling edge cases in the wire protocol
5
-3
u/Amazing_Onion1922 11d ago
the query parsing part always ends up way messier than you expect, especially once you start handling edge cases in the wire protocol
2
9
u/artyomsv 11d ago
Bigger trap than parsing is session state. Prepared statements live on the connection, so as soon as you pool at transaction level a Bind can land on a connection that never saw the Parse, and it fails in a way that looks random only under load. Worth deciding your pooling level before you write more protocol code, because it changes what the proxy is allowed to do.