-
-
Couldn't load subscription status.
- Fork 585
Description
oltp_point_select spends a lot of time in parser, maybe ~30% of analyzer time (the time spent in execution barely registers in profile). If prepared statements cache the AST rather than a PreparedQuery, we'd trim this time to almost 0%:
I had back luck with my first stab at this, but I don't think it should be particularly edge-casey. The only thing we really need is a reliably way to walk an AST and copy it into a format with BindVar replaced with expression.Literal. The built-in walking helper ast.Walk might need a visitor capable of implicitly buffering/accumulating child nodes during an in-order traversal. Any other implementation that treats the cached AST as immutable and generates a copy with BindVariables replaced is equally great.
Saving the AST rather than the post-planbuilder node is a preferable step because we get most of the performance benefit with little correctness risk.