AQO is a Shardman extension that uses query execution statistics for improving cardinality estimation.
To turn on AQO:
Add aqo to the shared_preload_libraries
parameter in sdmspec.json.
Create extension aqo on all nodes.
SET shardman.broadcast_ddl TO ON; CREATE EXTENSION aqo; RESET shardman.broadcast_ddl;
Set aqo.mode for learn and run
queries that you want to optimize with EXPLAIN ANALYZE until the plan stops changing.
BEGIN; SET aqo.mode = 'learn'; EXPLAIN ANALYZE <query> RESET aqo.mode; COMMIT;
Note that aqo statistics is collected separately on all nodes in
a Shardman cluster. So you need to repeat this process on each node in
the cluster. Alternatively, you can set aqo.mode to
learn and run your application for some time and later turn it
back to the default mode (controlled).
AQO will not be activated if you join less than
aqo.join_threshold relations (3 by default).
Complete aqo documentation can be found here.