Optimizer trace contains a lot of info describing the query:
- Original query text
- Definitions of all used VIEWs
- All kinds of estimates that the optimizer used:
- records_in_range estimates
- index statistics used by
- selectivity estimates
- table read costs
- Indexes considered by the optimizer
This makes it possible to debug an optimizer problem: re-run the optimizer and manually re-create the environment by "faking" the record counts and the estimates.
There are two problems
- 1. Optimizer trace is not fully self-contained.
- 2. Re-creating the environment is labor-intensive (I wrote dirty patches that put the fake statistics in place)
This task is about solving #1, and possibly #2.
For #1, we need:
- Column definitions (their datatypes. Basically, SQL definitions).
- TODO: anything else?