This question was originally asked on the Trino Slack.
Hi everyone,
Is there any example code/blog/documentation regarding how we can dump plans for previously executed queries and view it from UI several days/week after execution?
This question was originally asked on the Trino Slack.
Hi everyone,
Is there any example code/blog/documentation regarding how we can dump plans for previously executed queries and view it from UI several days/week after execution?
Not that I know of but this is something that has been asked in the past. In general you would have to write your own plugin that listens for a query event and dump info to some location. You will just set up your listener call whatever observability tool you have
There are some open source event listener plugins available that you may want to check out which you could either use or base your own plugin off of as @brian.zhan mentioned:
There is also a mysql trino event listener that dump the history into a database. Then you can configure a catalog to query it.
And HTTP event listener just posts it to a HTTP endpoint … so you can hook up whatever ingestion there.
https://trino.io/docs/current/admin/event-listeners-http.html
To track previously executed query plans and view them later from a user interface, you can use query logging in your database management system. This feature records executed queries and their execution plans in log files. Alternatively, third-party monitoring tools or built-in performance monitoring solutions may offer web-based interfaces to access and analyze historical query performance data, including execution plans.
Specific steps and tools vary depending on the database system used, so consult the relevant documentation for your system and any monitoring tools you wish to employ. Always ensure compliance with licensing, security, and data privacy requirements when using third-party tools.
Note that query logging/query history are features of Starburst Galaxy and Starburst Enterprise only. For Trino you have to use an event listeners as discussed in my answer.