Assigned
Status Update
Comments
ba...@google.com <ba...@google.com>
ku...@google.com <ku...@google.com> #2
Hello,
Thank you for reaching out to us with your request.
We have duly noted your feedback and will thoroughly validate it. While we cannot provide an estimated time of implementation or guarantee the fulfillment of the issue, please be assured that your input is highly valued. Your feedback enables us to enhance our products and services.
We appreciate your continued trust and support in improving our Google Cloud Platform products. In case you want to report a new issue, Please do not hesitate to create a new issue on the
Once again, we sincerely appreciate your valuable feedback; Thank you for your understanding and collaboration.
Description
Hello,
Background on PostgreSQL and query plans
TL;DR
feel free to skip directly to the feature request below if you are already aware of the loops caveat in explain plan actuals.PostgreSQL can surface “Actual” query runtime telemetry via ANALYZE argument of EXPLAIN.
For example:
Given the above, one would think that the query actually took 2.492 ms to run, and processed 25677 rows. However, this important caveat from the EXPLAIN ANALYZE [1] documentation tells us that this is not true:
Taking the loops caveat into consideration, the Actual Rows here are
25677 rows * 410652 loops
; roughly 10 billion rows and Actual Time is2.492 ms * 410652 loops
; roughly 1023 seconds.Most Postgres EXPLAIN plan visualization/evaluation tools take this caveat into account and apply logic in order to properly display the costs/timings of the plan. Here is an example anonymized plan [2] and also attached [3].
The Feature request
In Cloud SQL, Query Insights shows a visual representation of an EXPLAIN plan similar to the community built tools. It also offers useful tips, pointing out plan nodes with the "Highest Latency”, “Highest Row count” and “Highest Cost”.
Unfortunately, this information is not always accurate; specifically regarding the loops caveat.
Here is an example of where Cloud SQL gets the Latency correct, but it does not apply the loops caveat so the number of rows is incorrect and thus, the "Highest Row count" tip is also incorrect. [4]
Additionally, the “Highest Latency” feature does not work properly. It labels the parent plan node as the “Highest Latency”, yet the only reason the latency is high in the Parent is because of this child subplan node. The example above should be labeled “Highest Latency”, “Highest Row count” and probably “Highest cost”, or cost should be thrown out all together when dealing with the loop caveat as it cannot be trusted.
In Summary, make the following enhancements to Query Insights plan visualizer:
I understand that this information can be retrieved by configuring auto_explain, but having it in the UI would make it much more accessible to Cloud SQL users.
Thank you!
References:
[1]https://www.postgresql.org/docs/current/using-explain.html#USING-EXPLAIN-ANALYZE https://explain.dalibo.com/plan/964ec4a3f2b3c1a9#plan/node/10
[2]
[3] dalibo_screenshot.jpg
[4] bad_rows_returnd.jpg