Alert for Long running/blocking queries for azure database for postgresql

sql user 86 Reputation points
2021-03-23T10:53:19.06+00:00

Hello Experts.

We have a azure database for postgresql hosted and we would like to have an alert email sent for
long running queries and blocking happening on PAAS instance. can you please suggest with queries and steps? . We have already enabled diagnostic logging on PAAS instance and logs are getting stored on log analytics workspace.

Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. Navtej Singh Saini 4,226 Reputation points Microsoft Employee
    2021-03-30T00:06:11.557+00:00

    @sql user

    Here is the answer from our team.

    "We don't have a native notification service tied to Intelligent Performance/ Query Store but we do expose APIs that will allow you to query the data periodically. They could also query the azure_sys database directly using sql. Building a workflow on top of either is obviously one choice. The cons here is it will put load on top of your OLTP workload for the duration your Query Store query runs.
    The second way to achieve this is to integrate with Log analytics. Query Store data is published to Log Analytics so that customers can integrate easily with the different popular third party monitoring apps. If your Cx uses one of these apps and they have a notification service, that's another way to go about this. This has zero impact on your core OLTP workload.
    If the Cx has a read replica set up, realize that QS data is replicated to the replica as-is from the primary. The cons here is: load on replica and this will have as much lag as replication lag."

    Here are three options to achieve this. Please check and let us know if any questions.

    Regards
    Navtej S


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.