YMatrix
Quick Start
Connecting
Benchmarks
Deployment
Data Usage
Manage Clusters
Upgrade
Global Maintenance
Expansion
Monitoring
Security
Best Practice
Technical Principles
Data Type
Storage Engine
Execution Engine
Streaming Engine(Domino)
MARS3 Index
Extension
Advanced Features
Advanced Query
Federal Query
Grafana
Backup and Restore
Disaster Recovery
Guide
Performance Tuning
Troubleshooting
Tools
Configuration Parameters
SQL Reference
ORCA is a new modular query optimizer in YMatrix that replaces the traditional PostgreSQL planner. It delivers significant performance improvements for certain OLAP query workloads. By default, the ORCA optimizer is disabled in YMatrix. To use ORCA, you must explicitly enable the optimizer configuration parameter. When enabled, YMatrix attempts to use ORCA to generate execution plans for queries. If ORCA cannot handle a query, the system falls back to the PostgreSQL-based planner.
The system boundary of ORCA is shown in the figure below. The ORCA optimizer resides at the bottom, and the database system sits above it.
ORCA accepts a query (Query) and metadata (MetaData, or MD) from the database system as input and outputs a physical execution plan (Plan). All three—Query, MD, and Plan—are represented in DLX format.

The internal structure of ORCA is illustrated in the following diagram, which includes components such as Job Execution, Job Scheduler, Memo, and OS.

Memo:
Search: Represents three types of jobs:
Job Scheduler: Orchestrates and executes optimization jobs.
Transformations: Rules that transform expressions in the Memo. There are two main categories:
Property Enforcement: Enhances data properties.
Metadata Cache: Caches metadata accessed during optimization.
OS: Low-level library handling I/O, exceptions, memory management, concurrency, and other system services.
When optimizer = on, YMatrix uses ORCA instead of the legacy planner. You can control ORCA behavior using the optimizer server configuration parameter at the system, database, session, or query level. To change the default setting, follow one of the procedures below.
Set the optimizer server configuration parameter for the entire YMatrix system:
mxadmin (the YMatrix database administrator).gpconfig utility to set the parameter to on:gpconfig -c optimizer -v on
mxstop -u
Use the ALTER DATABASE command to enable ORCA for a single database. For example, to enable ORCA for database test_db:
ALTER DATABASE test_db SET OPTIMIZER = ON;
Use the SET command to enable ORCA for the current session. For example, after connecting via psql:
SET optimizer = on;
To enable ORCA for a specific query, include the SET command immediately before running the query.
Note!
For more information about ORCA-related configuration parameters, see ORCA Optimizer Configuration Parameters.
When ORCA is enabled (it is off by default), you can verify whether YMatrix used ORCA or fell back to the legacy planner by examining the output of EXPLAIN.
If ORCA generated the plan, the plan output ends with a line indicating the optimizer and its version. For example:
Optimizer: ORCA
If the optimizer parameter is off, or if ORCA was enabled but the query fell back to the legacy planner, the output shows:
Optimizer: Postgres-based planner
Note!
When YMatrix falls back to the legacy planner, the query plan is influenced by the legacy optimizer’s configuration parameters. For details, see Operator Control Parameters.
The following SQL features are not supported when ORCA is enabled:
CUBEROWROWCOMPAREFIELDSELECTON MASTER or ON ALL SEGMENTS attributes.SELECT, UPDATE, and DELETE commands that use the ONLY keyword to reference a table name.