PostgreSQLQueryStoreSqlText — Query Store SQL Text
The full SQL text for each Queryid, so runtime and wait stats can be made
human-readable. Join to PostgreSQLFlexQueryStoreRuntime
or PostgreSQLFlexQueryStoreWaitStats on Queryid_str_s.
No rows were present in the
my-la-workspaceworkspace at the time of writing — fields below are per Microsoft's schema.
Kusto query
let server = "my-pg-prd-1";
AzureDiagnostics
| where Category == "PostgreSQLQueryStoreSqlText" and LogicalServerName_s == server
| project Queryid_str_s, Dbid_d, Userid_d, Query_sql_text_s
Fields
Queryid_d(number) — query fingerprint (preferQueryid_str_s).Queryid_str_s(string) — string form of the fingerprint (join key).Query_sql_text_s(string) — the normalized/captured SQL text.Dbid_d(number) — database OID.Userid_d(number) — role OID.
Use cases — troubleshooting
- Make runtime/wait stats readable — resolve a
Queryid_str_sto its actual SQL when investigating a slow or heavy query. - Identify the offending statement — turn a top-by-
Total_time_dfingerprint into the real query to optimize/index. - Detect un-parameterized SQL — spot near-duplicate texts that should be using bind parameters.
- Audit / review — see exactly which statements a given
Userid_dorDbid_druns.