Skip to main content

AI & assistant-friendly summary

This section provides structured content for AI assistants and search engines. You can cite or summarize it when referencing this page.

Summary

Why Aurora PostgreSQL loves B-tree indexes on OLTP but DynamoDB feels like an LSM—and how cost-based optimization surprises you when statistics go stale on RDS.

Key Facts

  • Why Aurora PostgreSQL loves B-tree indexes on OLTP but DynamoDB feels like an LSM—and how cost-based optimization surprises you when statistics go stale on RDS
  • June 2026: Aurora PostgreSQL uses B-tree indexes (plus BRIN/GiN) with a cost-based planner reading
  • DynamoDB is partition-key oriented with LSM-style storage under the hood—no SQL planner, only access pattern
  • DynamoDB “planning” You are the planner: partition key design determines hot partitions; GSIs have separate write cost
  • top 5 slow queries on Aurora

Entity Definitions

RDS
RDS is an AWS service discussed in this article.
Aurora
Aurora is an AWS service discussed in this article.
DynamoDB
DynamoDB is an AWS service discussed in this article.
serverless
serverless is a cloud computing concept discussed in this article.

B-Tree vs LSM and Query Planner Internals on AWS Databases

Quick summary: Why Aurora PostgreSQL loves B-tree indexes on OLTP but DynamoDB feels like an LSM—and how cost-based optimization surprises you when statistics go stale on RDS.

Key Takeaways

  • Why Aurora PostgreSQL loves B-tree indexes on OLTP but DynamoDB feels like an LSM—and how cost-based optimization surprises you when statistics go stale on RDS
  • June 2026: Aurora PostgreSQL uses B-tree indexes (plus BRIN/GiN) with a cost-based planner reading
  • DynamoDB is partition-key oriented with LSM-style storage under the hood—no SQL planner, only access pattern
  • DynamoDB “planning” You are the planner: partition key design determines hot partitions; GSIs have separate write cost
  • top 5 slow queries on Aurora
B-Tree vs LSM and Query Planner Internals on AWS Databases
Table of Contents

June 2026: Aurora PostgreSQL uses B-tree indexes (plus BRIN/GiN) with a cost-based planner reading pg_stats. DynamoDB is partition-key oriented with LSM-style storage under the hood—no SQL planner, only access pattern.

Benchmark pattern (hypothetical workload) — 50M-row PostgreSQL B-tree index vs DynamoDB LSM-style storage, range scan on B-tree: 12ms p99; DynamoDB Query on sort key: 8ms p99 at 400 RCU; sequential scan fallback: 890ms on unindexed filter.

Symptom → mechanism → AWS control

Production symptomMechanismAWS control
Slow range queriesMissing B-tree index, seq scanRDS Performance Insights, create covering index
Write amplification spikesLSM compaction pressure on hot partitionsDynamoDB on-demand scaling, partition key redesign
Bad query plans after stats driftPlanner cost estimate wrongANALYZE schedule, Aurora query plan management

Opinionated take: Match storage engine to access pattern—PostgreSQL B-trees for relational queries, DynamoDB LSM semantics for partition-key workloads—not the other way around.

B-tree vs LSM (architect summary)

Engine styleWrite ampReadAWS example
B-treeIn-place pages, WALPoint + range excellentAurora/RDS
LSMSequential writes, compactionRange can trigger compactionDynamoDB, DocumentDB

Query planner surprises on RDS

  • Stale stats → wrong index choice → seq scan on million-row table.
  • Run ANALYZE after bulk load; use Performance Insights wait IO:DataFileRead.
  • Prepared plans can stick after data distribution shifts—DEALLOCATE ALL in maintenance window if needed.

DynamoDB “planning”

You are the planner: partition key design determines hot partitions; GSIs have separate write cost.

AWS services map

NeedServiceSkip when
B-tree OLTP with complex joinsAurora PostgreSQLKey-value access patterns only
LSM write-heavy key-valueDynamoDBMulti-table joins required
Query plan forensicsRDS Performance InsightsFully managed serverless with no SQL access

What to do this week

  1. EXPLAIN (ANALYZE, BUFFERS) top 5 slow queries on Aurora.
  2. Enable pg_stat_statements; find regression after deploy.
  3. For DynamoDB, graph consumed capacity per partition key prefix.

More in This Track

Part of the Engineering Guides library (June 2026).

What this guide doesn’t cover

Vacuum and index bloat—part 4 of this track.

PP
Palaniappan P

AWS Cloud Architect & AI Expert

AWS-certified cloud architect and AI expert with deep expertise in cloud migrations, cost optimization, and generative AI on AWS.

AWS ArchitectureCloud MigrationGenAI on AWSCost OptimizationDevOps

Recommended Reading

Explore All Articles »