• Each segment is responsible for executing local database operations on its
own set of data. The segments are scanned in parallel.
Once the query is executed, the results are returned to the master, which in turn
returns the results to the client. Optimal distribution and partitioning strategy is
key to the query performance.
Analyzing and optimizing queries
The ANALYZE function
It is very critical to get statistics to realize good query plans that would give good res-
ults. The ANALYZE operation requires only a read lock on the table and can possibly
run in parallel.
For INSERT , UPDATE , DELETE , and CREATE INDEX operations, always run
gp_autostats_mode to auto analyze during these operations.
Following is the syntax for the ANALYZE command:
ANALYZE [table [ (column [, ...] ) ]]
ANALYZE by default analyzes all tables and all columns unless specified. The stat-
istics for the following scenarios would be useful:
• The JOIN condition
• The WHERE clause
• The SORT clause
• The GROUP BY or HAVING clause