You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To implement this cleanly, I think we need to stop using Hasql.Snippet in our internal modules and only use it at the top level (App.hs). This would have the nice side-effect of making our query generation "pure" too.
Then we would have something like:
apiReq <-ApiRequest.userApiRequest conf req body sCache
plan <-Plan.actionPlan iAction conf apiReq sCache
queries <-Statement.generateSQL plan
-- here we can now log the queries as they would be simple `ByteString`s
resultset <-Decoders.decode $-- since generateSQL won't generate Hasql.Snippet, we would now need an explicit decoding step (it would be good to expose this as a new timing too)Query.execute queries $-- here we now execute it with Hasql-- then build the response as usual-- code simplified from https://github.com/PostgREST/postgrest/blob/d0173e71923e15b412fd459e35e1d5b97161a363/src/PostgREST/App.hs#L148-L166
Doing the above would require a series of refactors.
The text was updated successfully, but these errors were encountered:
Thinking more about this, to be really full we would need to also log the Schema cache queries at startup. That would need a similar treatment of "purifying" our SQL generation from Hasql too, I believe.
Problem
Currently log-query doesn't log:
explain
query wheneverPrefer: count=estimated
is done (ref).Solution
Log all generated queries for
log-query = full
.Implementation details
Hasql.Snippet
in our internal modules and only use it at the top level (App.hs
). This would have the nice side-effect of making our query generation "pure" too.The text was updated successfully, but these errors were encountered: