MaterializeInc / materialize

The Cloud Operational Data Store: use SQL to transform, deliver, and act on fast-changing data.
https://materialize.com
Other
5.72k stars 466 forks source link

Query history does not measure the full query duration #28448

Open chaas opened 1 month ago

chaas commented 1 month ago

What version of Materialize are you using?

v0.109.1

What is the issue?

The query durations as reported in the query history (mz_recent_activity_log) are not capturing the full query time. As reported:

have a query that is "fast" through clusterd, and reported as fast through the query history, but is actually slow

See thread here https://materializeinc.slack.com/archives/CU7ELJ6E9/p1719868508363029 Potential reason:

It seems to be the work merging and sorting the returned row sets. Ideally we wouldn't do that at all in envd, instead only doing a merge (or presenting a merge iterator).

Desired outcome: have the duration/finished_at time accurately represent the time at which the query finished executing and began returning rows. This should match the psql \timing

benesch commented 1 month ago

This should match the psql \timing

Modulo network roundtrip time! The psql \timing command runs client side, so it includes the time taken for the request to hit the server and the response to come back from the server.