<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma" -->

---
title: PostgreSQL to SQL Field Notes: Operational Statistics
description: PostgreSQL developers moving to Azure SQL get a comparison of operational diagnostics between the two engines. PostgreSQL offers views like pg_stat_activity...
canonical: https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: PostgreSQL to SQL Field Notes: Operational Statistics | daily.dev
og:description: PostgreSQL developers moving to Azure SQL get a comparison of operational diagnostics between the two engines. PostgreSQL offers views like pg_stat_activity...
og:url: https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma
og:image: https://api.daily.dev/og/posts/DkCclOpMa.png
og:image:alt: PostgreSQL to SQL Field Notes: Operational Statistics
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL to SQL Field Notes: Operational Statistics

**[DevBlogs](https://daily.dev/sources/devblogs)** · 14 min read · 0 upvotes · 0 comments

## Summary

PostgreSQL developers moving to Azure SQL get a comparison of operational diagnostics between the two engines. PostgreSQL offers views like pg_stat_activity and EXPLAIN ANALYZE, but inspecting a running query's live execution plan or retrieving a completed query's actual plan normally needs extensions or extra configuration, such as pg_stat_statements or auto_explain. Azure SQL exposes this natively through DMVs like sys.dm_exec_requests, sys.dm_exec_query_plan_stats, sys.dm_exec_query_memory_grants, and sys.dm_db_missing_index_details, which can even recommend indexes based on actual query activity. Core PostgreSQL 18 has no general equivalent to Azure SQL's live execution diagnostics, the post states.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://devblogs.microsoft.com/azure-sql/pg-to-sql-statistics>

## Questions this post answers

### How can I see the execution plan of a query that is currently running in PostgreSQL 18?

Core PostgreSQL 18 has no general equivalent to Azure SQL's live execution diagnostics for an arbitrary running SELECT query. You can see the query in pg_stat_activity and use progress views for vacuum, index creation, or copying, and pg_log_backend_memory_contexts logs memory contexts, but none of these expose live operator-level progress for a running query; EXPLAIN ANALYZE requires re-running it under instrumentation instead.

_If live query visibility matters for your Postgres-to-Azure SQL migration, daily.dev surfaces database engineering comparisons like this one._

### How do I inspect an in-flight query's execution plan in Azure SQL?

Use sys.dm_exec_query_statistics_xml(session_id) cross-applied to sys.dm_exec_requests to retrieve an in-flight plan with operator-level runtime statistics, including rows processed and where time accumulates. This lets you investigate a slow running query, such as one active for five minutes, without canceling it or reproducing the workload separately.

_Developers debugging live production slowdowns can keep up with database diagnostics techniques like this via daily.dev._

### Does PostgreSQL retain actual execution plans for queries after they finish running?

No, pg_stat_statements provides aggregate execution counts, timing, and buffer activity for completed queries but does not retain their actual execution plans. Getting actual runtime statistics for a finished query requires advance configuration via auto_explain with log_analyze, which can add measurable instrumentation overhead, particularly for per-operator timing, unlike Azure SQL's cached last actual plan retrieval.

_Teams comparing Postgres and Azure SQL diagnostics for a migration decision can track deep-dives like this on daily.dev._

## Similar posts on daily.dev

- [Debug PostgreSQL query latency faster with EXPLAIN ANALYZE in Datadog Database Monitoring](https://daily.dev/posts/debug-postgresql-query-latency-faster-with-explain-analyze-in-datadog-database-monitoring-kwcnveyee) · Datadog · 40 upvotes · 0 comments
- [Postgres Monitoring for SQL Server DBAs: Statistics and Logs 101](https://daily.dev/posts/postgres-monitoring-for-sql-server-dbas-statistics-and-logs-101-am6ptsgaz) · pganalyze · 2 upvotes · 0 comments
- [PostgreSQL Like A Pro: Build, query, and troubleshoot without leaving VS Code](https://daily.dev/posts/postgresql-like-a-pro-build-query-and-troubleshoot-without-leaving-vs-code-iolbaeonx) · DevBlogs · 0 upvotes · 0 comments
- [PostgreSQL on Azure supercharged for AI](https://daily.dev/posts/postgresql-on-azure-supercharged-for-ai-jtprqmakm) · Microsoft Azure · 4 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#azure](https://daily.dev/tags/azure), [#postgresql](https://daily.dev/tags/postgresql), [#microsoft-sql-server](https://daily.dev/tags/microsoft-sql-server)

[View this post on daily.dev](https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"PostgreSQL to SQL Field Notes: Operational Statistics","url":"https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma"},"datePublished":"2026-10-28T18:50:45.609Z","dateModified":"2026-10-28T18:54:39.406Z","description":"PostgreSQL developers moving to Azure SQL get a comparison of operational diagnostics between the two engines. PostgreSQL offers views like pg_stat_activity...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b517fb5d6ce636b53cfbca99b471ebdf?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b517fb5d6ce636b53cfbca99b471ebdf?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"DevBlogs","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"DevBlogs","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/8f68b453325f482ebeb73fb780092713","url":"https://daily.dev/sources/devblogs"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"database,azure,postgresql,microsoft-sql-server","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DevBlogs","item":"https://daily.dev/sources/devblogs"},{"@type":"ListItem","position":3,"name":"PostgreSQL to SQL Field Notes: Operational Statistics"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/postgresql-to-sql-field-notes-operational-statistics-dkcclopma#faq","mainEntity":[{"@type":"Question","name":"How can I see the execution plan of a query that is currently running in PostgreSQL 18?","acceptedAnswer":{"@type":"Answer","text":"Core PostgreSQL 18 has no general equivalent to Azure SQL's live execution diagnostics for an arbitrary running SELECT query. You can see the query in pg_stat_activity and use progress views for vacuum, index creation, or copying, and pg_log_backend_memory_contexts logs memory contexts, but none of these expose live operator-level progress for a running query; EXPLAIN ANALYZE requires re-running it under instrumentation instead. If live query visibility matters for your Postgres-to-Azure SQL migration, daily.dev surfaces database engineering comparisons like this one."}},{"@type":"Question","name":"How do I inspect an in-flight query's execution plan in Azure SQL?","acceptedAnswer":{"@type":"Answer","text":"Use sys.dm_exec_query_statistics_xml(session_id) cross-applied to sys.dm_exec_requests to retrieve an in-flight plan with operator-level runtime statistics, including rows processed and where time accumulates. This lets you investigate a slow running query, such as one active for five minutes, without canceling it or reproducing the workload separately. Developers debugging live production slowdowns can keep up with database diagnostics techniques like this via daily.dev."}},{"@type":"Question","name":"Does PostgreSQL retain actual execution plans for queries after they finish running?","acceptedAnswer":{"@type":"Answer","text":"No, pg_stat_statements provides aggregate execution counts, timing, and buffer activity for completed queries but does not retain their actual execution plans. Getting actual runtime statistics for a finished query requires advance configuration via auto_explain with log_analyze, which can add measurable instrumentation overhead, particularly for per-operator timing, unlike Azure SQL's cached last actual plan retrieval. Teams comparing Postgres and Azure SQL diagnostics for a migration decision can track deep-dives like this on daily.dev."}}]}
```

