DrPostgres / pg_plan_guarantee

Postgres Query Optimizer Extension that guarantees your desired plan will not change
PostgreSQL License
92 stars 1 forks source link

Compare parse trees instead of query strings #4

Open danolivo opened 8 months ago

danolivo commented 8 months ago

thanks for your efforts, As I see, you use query string comparisons as a criteria that the stored plan matches incoming query. I think it is a bad idea. Do you remember that rewrite rules could change? If someone changed definition of a VIEW, query text would be the same, but plan is totally different. IMO, the only criteria is parse tree comparison and you should save both: plan and parse tree. Also, remember indexes. Before returning the plan you need to check existence of all indexes invloved.