FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
PostgreSQL global statistics on partitionned table require a manual ANALYZE
How-ToSystems

PostgreSQL global statistics on partitionned table require a manual ANALYZE

via Dev.toFranck Pachot1mo ago

PostgreSQL auto-analyze collects statistics on tables with rows. For partitioned tables, it excludes the parent as it has no rows by itself. So how does the query planner estimate cardinality when a query spans multiple partitions? Some statistics are easy to derive: if it knows each partition’s row count, the global count is the total. Column statistics are trickier, especially with the number of distinct values, a key factor to estimate cardinalities with predicates or aggregates. Even with the number of distinct values per partition, it still doesn’t know how much those values overlap across partitions. The global distinct count therefore lies between the maximum per-partition distinct count and the sum of all per-partition counts. Here is an example: create table history ( year int , num serial , x int , y int , primary key ( year , num ) ) partition by list ( year ) ; create table history_2024 partition of history for values in ( 2024 ); create table history_2025 partition of hist

Continue reading on Dev.to

Opens in a new tab

Read Full Article
25 views

Related Articles

Android Remote Compose:讓 Android UI 不用發版也能更新
How-To

Android Remote Compose:讓 Android UI 不用發版也能更新

Medium Programming • 3d ago

How-To

Learn Something Old Every Day, Part XVIII: How Does FPU Detection Work?

Lobsters • 3d ago

“Learn to Code” Is Dead… Learn to Think Instead
How-To

“Learn to Code” Is Dead… Learn to Think Instead

Medium Programming • 4d ago

How-To

How One File Makes Claude Code Actually Follow Your Instructions

Medium Programming • 4d ago

LeetCode Solution: 121. Best Time to Buy and Sell Stock
How-To

LeetCode Solution: 121. Best Time to Buy and Sell Stock

Dev.to Tutorial • 4d ago

Discover More Articles