qustavo / sqlhooks

Attach hooks to any database/sql driver
MIT License
650 stars 44 forks source link

QueryerContext interface and prepared statements #22

Closed surki closed 5 years ago

surki commented 5 years ago

If we don't implement QueryerContext or Queryer interface for connection, db.Query() will always do statement "prepare" and statement "exec". These extra roundtrips can add unneeded latency.

Run this test program and check in wireshark: https://play.golang.org/p/wvmsGliLPpz

A change like this fixes this: https://github.com/surki/sqlhooks/commit/98e9bd8ddee254ae4ae9ad8058c37e993ec097d8

I could send a PR if you would like this fixed here

qustavo commented 5 years ago

Cool, please open the PR