pg
pg copied to clipboard
Add support for sqlcommenter
Summary
It would be great if go-pg could support sqlcommenter to gain insights about query performance of particular client apps or components.
Reference implementations for other languages\ORMs are available in this repo: https://github.com/google/sqlcommenter/
Possible Implementation
For simplest integration go-pg could allow adding arbitrary comments to queries. This way clients could have full control of the syntax and desired tags. This could be even used by other tools, not only sqlcommenter.
Or go-pg could have builtin coverage of sqlcommenter features, with tags like framework
, route
etc like in reference implementations.
I am not saying we should not support sqlcommenter, but we have tracing support that achieves the same - https://pg.uptrace.dev/tracing/
but we have tracing support that achieves the same
Not exactly. This is more like client-side tracing. Among others, it includes network costs. When we see that a query took 200ms it might mean that there was a network latency of 100ms and it took Postgres 100ms to execute query. Without a question this is still useful, but with sqlcommenter tooling we can measure pure database performance.