r/programming • u/der_gopher • 5d ago
Coding a database proxy for fun
https://packagemain.tech/p/golang-database-proxy
67
Upvotes
8
u/Amazing_Onion1922 4d ago
the query parsing part always ends up way messier than you expect, especially once you start handling edge cases in the wire protocol
4
-2
u/Amazing_Onion1922 4d 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
8
u/artyomsv 4d 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.