Steps that I took to get this to work:
Browsed to the Azure psql flexible server instance and the Diagnostic Settings blade to create the Diagnostic resource. This is a prerequisite to set up the Query Store for enhanced logs.
On the sae psql flexible instance, I clicked on the Settings | Server parameters blade and filtering on "auto_explain"
I confirmed that at minimum the following were set:
auto_explain.log_analyze
to ON
auto_explain.log_buffers
to ON
auto_explain.log_timing
to ON
auto_explain.log_verbose
to ON
Browsed to the Monitoring | Troubleshooting guides blade. Confirmed there was a graph at the bottom. Selected the Queries tab and the interval of time (e.g. last hour). There were a list of (5) slowest queries each with a unique id.
Opened an admin (read) connection to the database instance and ran the following sql query against the azure_sys
database: SELECT query_sql_text FROM query_store.query_texts_view WHERE query_text_id = <query_id>;
and interpolate the query_id
with the numeric id gathered from the previous step. This is the raw sql query that ranked as one of the slowest (if not the slowest) in the query time range.
References: