{"id":1545,"date":"2019-03-19T00:00:00","date_gmt":"2019-03-19T00:00:00","guid":{"rendered":"https:\/\/azure.microsoft.com\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store"},"modified":"2025-06-19T03:31:38","modified_gmt":"2025-06-19T10:31:38","slug":"securely-monitoring-your-azure-database-for-postgresql-query-store","status":"publish","type":"post","link":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/","title":{"rendered":"Securely monitoring your Azure Database for PostgreSQL Query Store"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A few months ago, I shared <a href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/best-practices-for-alerting-on-metrics-with-azure-database-for-postgresql-monitoring\/\" target=\"_blank\" rel=\"noreferrer noopener\">best practices for alerting on metrics with Azure Database for PostgreSQL<\/a>. Though I was able to cover how to monitor certain key metrics on Azure Database for PostgreSQL, I did not cover how to monitor and alert on the performance of queries that your application is heavily relying on. As a PostgreSQL database, from time to time you will need to investigate if there are any queries running indefinitely on a PostgreSQL database. These long running queries may interfere with the overall database performance and likely get stuck on some background process. This blog post covers how you can set up alerting on query performance related metrics using <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/azure-functions\/functions-overview\" target=\"_blank\" rel=\"noreferrer noopener\">Azure Functions<\/a> and <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/key-vault\/key-vault-overview\" target=\"_blank\" rel=\"noreferrer noopener\">Azure Key Vault<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-query-store\">What is Query Store?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Query Store was a feature in Azure Database for PostgreSQL <a href=\"https:\/\/azure.microsoft.com\/en-us\/updates\/preview-of-query-store-for-azure-database-for-postgresql\/\" target=\"_blank\" rel=\"noreferrer noopener\">announced<\/a> in early Fall 2018 that seamlessly enables tracking query performance over time. This simplifies performance troubleshooting by helping you quickly find the longest running and most resource-intensive queries. Learn how you can use Query Store on a wide variety of scenarios by visiting our documentation, \u201c<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/postgresql\/concepts-query-store-scenarios\" target=\"_blank\" rel=\"noreferrer noopener\">Usage scenarios for Query Store<\/a>.\u201d Query Store, when enabled, automatically captures a history of query runtime and wait statistics. It tracks this data over time so that you can see database usage patterns. Data for all users, databases, and queries is stored in a database named <strong>azure_sys<\/strong> in the Azure Database for PostgreSQL instance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Query Store is not enabled on a server by default. However, it is very straightforward to opt-in on your server by following the simple steps detailed in our documentation, \u201c<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/postgresql\/concepts-query-store\" target=\"_blank\" rel=\"noreferrer noopener\">Monitor performance with the Query Store<\/a>.\u201d After you have enabled Query Store to monitor your application performance, you can set alerts on various metrics such as long running queries, regressed queries, and more that you want to monitor.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-set-up-alerting-on-query-store-metrics\">How to set up alerting on Query Store metrics<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can achieve near real-time alerting on Query Store metrics monitoring using Azure Functions and Azure Key Vault. This <a href=\"https:\/\/github.com\/Azure\/azure-postgresql\/tree\/master\/samples\/query-store\/a-single-if-then-this-alert\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub repo<\/a> provides you with an Azure Function and a PowerShell script to deploy a simple monitoring solution, which gives you some flexibility to change what and when to alert.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Alternatively, you can clone the repo to use this as a starting point and make code changes to better fit your scenario. The Visual Studio solution, when built with your changes, will automatically package the zip file you need to complete your deployment in the same fashion that is described here.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this repo, the script <strong>DeployFunction<\/strong> creates an Azure function to serve as a monitor for Azure Database for PostgreSQL Query Store. Understanding the data collected by <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/postgresql\/concepts-query-store\" target=\"_blank\" rel=\"noreferrer noopener\">query performance insights<\/a> will help you identify the metrics that you can alert on.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you don&#8217;t make any changes to the script or the function code itself and only provide the required parameters to <strong>DeployFunction <\/strong>script, here is what you will get:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"wp-block-list-item\">A function app.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">A function called PingMyDatabase that is time triggered every one minute.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">An alert condition that looks for any query that has a mean execution time of longer than five seconds since the last time query store data is flushed to the disk.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">An email when an alert condition is met with an attached list of all of the processes that was running on the instance, as well as the list of long running queries.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">A key vault that contains two secrets named<strong> pgConnectionString<\/strong> and <strong>senderSecret <\/strong>that hold the connection string to your database and password to your sender email account respectively.<\/li>\n\n\n\n<li class=\"wp-block-list-item\">An identity for your function app with access to a Get policy on your secrets for this key vault.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You simply need to run <strong>DeployFunction<\/strong> on Windows PowerShell command prompt. It is important to run this script from Windows PowerShell. Using Windows PowerShell ISE will likely result in errors as some of the macros may not resolve as expected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The script then creates the resource group and Key Vault deploys a monitoring function app, updates app configuration settings, and sets up the required Key Vault secrets. At any point during the deployment, you can view the logs available in the <strong>.logs<\/strong> folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After the deployment is complete, you can validate the secrets by going to the resource group in the Azure portal. As shown in the following diagram, two secrets keys are created, <strong>pgConnString<\/strong> and <strong>senderSecret<\/strong>. You can select the individual secrets if you want to update the value.<\/p>\n\n\n\n<figure class=\"wp-block-image has-custom-border\"><img decoding=\"async\" src=\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp\" alt=\"Screenshot of two secret keys being created\" style=\"border-radius:0px\" title=\"Screenshot of two secret keys being created\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Depending on the condition set in the <strong>SENDMAILIF_QUERYRETURNSRESULTS<\/strong> app settings, you will receive an email alert when the condition is met.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-can-i-customize-alert-condition-or-supporting-data-in-email\">How can I customize alert condition or supporting data in email?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After the default deployment goes through, using Azure portal you can update settings by selecting <strong>Platform features<\/strong> and then <strong>Application settings<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image has-custom-border\"><img decoding=\"async\" src=\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/86e84c0b-5900-4b2a-8b8d-a708972b49b0.webp\" alt=\"Screenshot of Platform features page\" style=\"border-radius:0px\" title=\"Screenshot of Platform features page\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You can change the run interval, mail to, if condition, or supporting data to be attached by making changes to the below settings and saving them on your exit.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Alternatively, you can simply use <strong>az cli<\/strong> to update these settings like the following.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n$cronIntervalSetting=\"CronTimerInterval=0 *\/1 * * * *\"\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\naz functionapp config appsettings set --resource-group yourResourceGroupName --name yourFunctionAppName --settings $cronIntervalSetting\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Or<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\naz functionapp config appsettings set --resource-group $resourceGroupName --name $functionAppName --settings \"SENDMAILIF_QUERYRETURNSRESULTS=select * from query_store.qs_view where mean_time > 5000 and start_time >= now() - interval '15 minutes'\"\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Below are common cases on conditions that you can monitor and alert by either updating the function app settings after your deployment goes through or updating the corresponding value in <strong>DeployFunction.ps1<\/strong> prior to your deployment:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Case<\/strong><\/td><td><strong>Function app setting name<\/strong><\/td><td><strong>Sample value<\/strong><\/td><\/tr><tr><td>Query 3589441560 takes more than <em>x<\/em> milliseconds on average in the last fifteen minutes<\/td><td>SENDMAILIF_QUERYRETURNSRESULTS<\/td><td>select * from query_store.qs_view where query_id = 3589441560 and mean_time &gt; x and start_time &gt;= now() &#8211; interval &#8217;15 minutes&#8217;<\/td><\/tr><tr><td>Queries with cache hit less than 90 percent<\/td><td>SENDMAILIF_QUERYRETURNSRESULTS<\/td><td>select * , shared_blks_hit \/ nullif(shared_blks_hit + shared_blks_read, 0) AS as cache_hit from query_store.qs_view where shared_blks_hit \/ nullif(shared_blks_hit + shared_blks_read, 0) &lt; 0.90<\/td><\/tr><tr><td>Queries with a mean execution time that is more than x milliseconds<\/td><td>SENDMAILIF_QUERYRETURNSRESULTS<\/td><td>select * from query_store.qs_view where mean_time &gt; x and start_time &gt;= now() &#8211; interval &#8217;15 minutes&#8217;<\/td><\/tr><tr><td>If an alert condition is met, check if there is an ongoing autovacuum operation, list the processes running and attach the results to email<\/td><td>LIST_OF_QUERIESWITHSUPPORTINGDATA<\/td><td>{\u201ccount_of_active_autovacuum\u201d:\u201d select count(*) from pg_stat_activity where position(&#8216;autovacuum:&#8217; IN query) = 1 \u201c,&#8221;list_of_processes_at_the_time_of_alert&#8221;:&#8221;select now()-query_start as Running_Since,pid,client_hostname,client_addr, usename, state, left(query,60) as query_text from pg_stat_activity&#8221;}<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-secure-is-this\">How secure is this?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The script provides you with the mechanism to store your secrets in a Key Vault. Your secrets are secured as they are encrypted in-transit and at rest. However, the function app accesses the Key Vault over the network. If you want to avoid this and access your secrets over your virtual network (VNet) through the backbone, you will need to configure a VNet for both your function app and your Key Vault. Note, that VNet support of function apps is in preview and is currently available in selected Azure regions. When the proper deployment scenarios are supported, we may revisit this script to accommodate the changes. Until then, you will need to configure a VNet manually to accomplish the setup below.<\/p>\n\n\n\n<figure class=\"wp-block-image has-custom-border\"><img decoding=\"async\" src=\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/0699fc02-1005-4d81-8783-9873c1b0e008.webp\" alt=\"Flowchart display of manually configruing a VNet\" style=\"border-radius:0px\" title=\"Flowchart display of manually configruing a VNet\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We are always looking to hear feedback from you. If you have any feedback for the Query Store on PostgreSQL, or monitoring and alerting on query performance, please don\u2019t hesitate to contact the <a href=\"mailto:AzureDatabaseforMySQLPostgreSQL@service.microsoft.com\">Azure Database for PostgreSQL team<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"acknowledgments\">Acknowledgments<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Special thanks to Korhan Ileri, Senior Data Scientist, for developing the script and contributing to this post. As well as Tosin Adewale, Software Engineer from the Azure CLI team for closely partnering with us.<\/p>\n\n\n<p>\u00a0<\/p>\n<pre>\u00a0<\/pre>\n<p>\u00a0<\/p>","protected":false},"excerpt":{"rendered":"<p>A few months ago, I shared best practices for alerting on metrics with Azure Database for PostgreSQL.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ms_queue_id":[],"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","_alt_title":"","footnotes":"","msx_community_cta_settings":[]},"categories":[1473,1466],"tags":[],"audience":[3057,3055,3056],"content-type":[1511],"product":[1565],"tech-community":[],"topic":[],"coauthors":[596],"class_list":["post-1545","post","type-post","status-publish","format-standard","hentry","category-databases","category-hybrid-multicloud","audience-data-professionals","audience-developers","audience-it-implementors","content-type-best-practices","product-azure-database-for-postgresql","review-flag-1680286581-295","review-flag-1680286581-56","review-flag-1680286581-364","review-flag-1680286584-658","review-flag-1-1680286581-825","review-flag-alway-1680286580-106","review-flag-fall-1680286584-980","review-flag-percent"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Securely monitoring your Azure Database for PostgreSQL Query Store | Microsoft Azure Blog<\/title>\n<meta name=\"description\" content=\"A few months ago, I shared best practices for alerting on metrics with Azure Database for PostgreSQL. Though I was able to cover how to monitor certain key metrics on Azure Database for PostgreSQL, I did not cover how to monitor and alert on the performance of queries that your application is heavily relying on\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Securely monitoring your Azure Database for PostgreSQL Query Store | Microsoft Azure Blog\" \/>\n<meta property=\"og:description\" content=\"A few months ago, I shared best practices for alerting on metrics with Azure Database for PostgreSQL. Though I was able to cover how to monitor certain key metrics on Azure Database for PostgreSQL, I did not cover how to monitor and alert on the performance of queries that your application is heavily relying on\" \/>\n<meta property=\"og:url\" content=\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Azure Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/microsoftazure\" \/>\n<meta property=\"article:published_time\" content=\"2019-03-19T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-19T10:31:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp\" \/>\n<meta name=\"author\" content=\"Harini Gupta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@azure\" \/>\n<meta name=\"twitter:site\" content=\"@azure\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Harini Gupta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/\"},\"author\":[{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/harini-gupta\/\",\"@type\":\"Person\",\"@name\":\"Harini Gupta\"}],\"headline\":\"Securely monitoring your Azure Database for PostgreSQL Query Store\",\"datePublished\":\"2019-03-19T00:00:00+00:00\",\"dateModified\":\"2025-06-19T10:31:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/\"},\"wordCount\":1267,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp\",\"articleSection\":[\"Databases\",\"Hybrid + multicloud\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/\",\"name\":\"Securely monitoring your Azure Database for PostgreSQL Query Store | Microsoft Azure Blog\",\"isPartOf\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp\",\"datePublished\":\"2019-03-19T00:00:00+00:00\",\"dateModified\":\"2025-06-19T10:31:38+00:00\",\"description\":\"A few months ago, I shared best practices for alerting on metrics with Azure Database for PostgreSQL. Though I was able to cover how to monitor certain key metrics on Azure Database for PostgreSQL, I did not cover how to monitor and alert on the performance of queries that your application is heavily relying on\",\"breadcrumb\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp\",\"contentUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog home\",\"item\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Databases\",\"item\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/category\/databases\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Securely monitoring your Azure Database for PostgreSQL Query Store\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#website\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/\",\"name\":\"Microsoft Azure Blog\",\"description\":\"Get the latest Azure news, updates, and announcements from the Azure blog. From product updates to hot topics, hear from the Azure experts.\",\"publisher\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization\",\"name\":\"Microsoft Azure Blog\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp\",\"contentUrl\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp\",\"width\":512,\"height\":512,\"caption\":\"Microsoft Azure Blog\"},\"image\":{\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/microsoftazure\",\"https:\/\/x.com\/azure\",\"https:\/\/www.instagram.com\/microsoftdeveloper\/\",\"https:\/\/www.linkedin.com\/company\/16188386\",\"https:\/\/www.youtube.com\/user\/windowsazure\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/person\/c702e5edd662b328b49b7e1180cab117\",\"name\":\"shakir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g7664e653ea371ce16eaf75e9fa8952c4\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g\",\"caption\":\"shakir\"},\"sameAs\":[\"https:\/\/azure.microsoft.com\"],\"url\":\"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/shakir\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Securely monitoring your Azure Database for PostgreSQL Query Store | Microsoft Azure Blog","description":"A few months ago, I shared best practices for alerting on metrics with Azure Database for PostgreSQL. Though I was able to cover how to monitor certain key metrics on Azure Database for PostgreSQL, I did not cover how to monitor and alert on the performance of queries that your application is heavily relying on","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/","og_locale":"en_US","og_type":"article","og_title":"Securely monitoring your Azure Database for PostgreSQL Query Store | Microsoft Azure Blog","og_description":"A few months ago, I shared best practices for alerting on metrics with Azure Database for PostgreSQL. Though I was able to cover how to monitor certain key metrics on Azure Database for PostgreSQL, I did not cover how to monitor and alert on the performance of queries that your application is heavily relying on","og_url":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/","og_site_name":"Microsoft Azure Blog","article_publisher":"https:\/\/www.facebook.com\/microsoftazure","article_published_time":"2019-03-19T00:00:00+00:00","article_modified_time":"2025-06-19T10:31:38+00:00","og_image":[{"url":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp","type":"","width":"","height":""}],"author":"Harini Gupta","twitter_card":"summary_large_image","twitter_creator":"@azure","twitter_site":"@azure","twitter_misc":{"Written by":"Harini Gupta","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#article","isPartOf":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/"},"author":[{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/harini-gupta\/","@type":"Person","@name":"Harini Gupta"}],"headline":"Securely monitoring your Azure Database for PostgreSQL Query Store","datePublished":"2019-03-19T00:00:00+00:00","dateModified":"2025-06-19T10:31:38+00:00","mainEntityOfPage":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/"},"wordCount":1267,"commentCount":0,"publisher":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization"},"image":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage"},"thumbnailUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp","articleSection":["Databases","Hybrid + multicloud"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/","name":"Securely monitoring your Azure Database for PostgreSQL Query Store | Microsoft Azure Blog","isPartOf":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage"},"image":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage"},"thumbnailUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp","datePublished":"2019-03-19T00:00:00+00:00","dateModified":"2025-06-19T10:31:38+00:00","description":"A few months ago, I shared best practices for alerting on metrics with Azure Database for PostgreSQL. Though I was able to cover how to monitor certain key metrics on Azure Database for PostgreSQL, I did not cover how to monitor and alert on the performance of queries that your application is heavily relying on","breadcrumb":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#primaryimage","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp","contentUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2019\/03\/f64268fb-a941-491f-9ad6-801bdacb8f19.webp"},{"@type":"BreadcrumbList","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/securely-monitoring-your-azure-database-for-postgresql-query-store\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog home","item":"https:\/\/azure.microsoft.com\/en-us\/blog\/"},{"@type":"ListItem","position":2,"name":"Databases","item":"https:\/\/azure.microsoft.com\/en-us\/blog\/category\/databases\/"},{"@type":"ListItem","position":3,"name":"Securely monitoring your Azure Database for PostgreSQL Query Store"}]},{"@type":"WebSite","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#website","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/","name":"Microsoft Azure Blog","description":"Get the latest Azure news, updates, and announcements from the Azure blog. From product updates to hot topics, hear from the Azure experts.","publisher":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/azure.microsoft.com\/en-us\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#organization","name":"Microsoft Azure Blog","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp","contentUrl":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-content\/uploads\/2024\/06\/microsoft_logo.webp","width":512,"height":512,"caption":"Microsoft Azure Blog"},"image":{"@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/microsoftazure","https:\/\/x.com\/azure","https:\/\/www.instagram.com\/microsoftdeveloper\/","https:\/\/www.linkedin.com\/company\/16188386","https:\/\/www.youtube.com\/user\/windowsazure"]},{"@type":"Person","@id":"https:\/\/azure.microsoft.com\/en-us\/blog\/#\/schema\/person\/c702e5edd662b328b49b7e1180cab117","name":"shakir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g7664e653ea371ce16eaf75e9fa8952c4","url":"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9342c7c05bb16548741bc5cd3a3e3b7ee0c8e746844ad2cc582db5beb5514c6f?s=96&d=mm&r=g","caption":"shakir"},"sameAs":["https:\/\/azure.microsoft.com"],"url":"https:\/\/azure.microsoft.com\/en-us\/blog\/author\/shakir\/"}]}},"msxcm_display_generated_audio":false,"msxcm_animated_featured_image":null,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Azure Blog","distributor_original_site_url":"https:\/\/azure.microsoft.com\/en-us\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/posts\/1545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/comments?post=1545"}],"version-history":[{"count":1,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/posts\/1545\/revisions"}],"predecessor-version":[{"id":42434,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/posts\/1545\/revisions\/42434"}],"wp:attachment":[{"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/media?parent=1545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/categories?post=1545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/tags?post=1545"},{"taxonomy":"audience","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/audience?post=1545"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/content-type?post=1545"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/product?post=1545"},{"taxonomy":"tech-community","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/tech-community?post=1545"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/topic?post=1545"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/azure.microsoft.com\/en-us\/blog\/wp-json\/wp\/v2\/coauthors?post=1545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}