Query planner: planner
planner uses statistics and saved plans to choose query plans. It requires
database, and saves plans in the database storage. Without planner, queries
use the built-in planner.
| Setting | Purpose | Default | Range |
|---|---|---|---|
queries | Maximum query identities tracked for learning. | 256 queries | 1–65,536 queries |
query-bytes | Memory reserved for query learning state. | 4 MiB | 64 KiB–1 GiB |
stored-plans | Maximum number of saved plans. | 1,024 plans | 0–1,048,576 plans |
stored-bytes | Maximum combined size of saved plan keys and values. | 1 MiB | 0–256 MiB |
Byte settings take integer counts of bytes in the configuration. Set
stored-plans or stored-bytes to zero to disable loading and saving plans.
Pending plan trials can use one third of query-bytes. With the default
4 MiB, 17 trials can wait at a time; at least one trial can always wait.
Dependencies
- Requires
database
Configuration
Select this plugin explicitly when opening the database:
{
"plugins": {
"database": {
"path": "app.db"
},
"planner": {
"query-bytes": 4194304
}
}
}
Usage
Select planner and database with a path when opening the database. Query execution can then use recorded statistics and saved plans. Use the explain request to inspect a query plan.