Optimize Query Performance

These topics follow the life of a query: first how a query is processed, then how to influence the optimizer’s decisions, and finally how to speed up execution or trade extra data structures for speed.

Understand query processing

How Queries Are Processed

How a query moves from parsing through planning to dispatch and execution.

How Queries Are Processed
Automatic Query Optimizations

How dynamic partition elimination and adaptive memory allocation cut down the data scanned.

Automatic Query Optimizations

Influence the optimizer

Use GPORCA Optimizer

Choose between the Postgres-based optimizer and GPORCA, and tune GPORCA itself.

Use GPORCA Optimizer
Update Statistics

Run ANALYZE so cost estimates match the actual data distribution.

Update Statistics
Use Query Plan Hints

Specify join order, join method, and scan method directly.

Use Query Plan Hints

Speed up execution

Execute Queries in Parallel

Increase the number of compute nodes during execution so one query uses more of the cluster.

Execute Queries in Parallel
Push Down Aggregation Operations

Move aggregation ahead of the join to reduce the rows that reach it.

Push Down Aggregation Operations
Optimize HashJoin Query Performance

Use RuntimeFilter to filter early while the hash table is built, easing memory and disk pressure.

Optimize HashJoin Query Performance

Trade structures for speed

Use Index Scan on AO Tables

Use an index instead of a full scan for point lookups and narrow ranges on AO tables.

Use Index Scan on AO Tables
Use Unique Indexes on AO Tables

Enforce uniqueness on AO tables at write time.

Use Unique Indexes on AO Tables
Use Automatic Materialized Views

Match existing materialized views during planning, with no SQL rewrite.

Use Automatic Materialized Views
Use Incremental Materialized Views

Refresh only the affected portion when base tables change, instead of recomputing everything.

Use Incremental Materialized Views