ossc-db / pg_hint_plan

Extension adding support for optimizer hints in PostgreSQL
Other
710 stars 103 forks source link

Integrate query IDs with the hint table #193

Closed michaelpq closed 4 months ago

michaelpq commented 4 months ago

The hint table is reworked so as the normalized query string is replaced by the query ID generated by PostgreSQL, based on the jumbling done by the backend. This has multiple advantages:

Regression tests are adjusted to cope with this patch, where a PL/PgSQL function is added to be able to retrieve the query ID from a query string, as a wrapper for EXPLAIN (VERBOSE, JSON FORMAT). The query IDs can vary across platforms, so these are hidden to keep the tests portable. The following tweaks are done to the regression tests:

The documentation is updated, and the code in charge of the query normalization that was inherited from pg_stat_statements is removed, shaving a good chunk of code. On version upgrade, the past table is removed, replaced by the new one. Using the hint table requires an upgrade up to 1.7.0.

michaelpq commented 4 months ago

I got to discuss this patch with @yamatattsu in live last Friday, and he was OK with the change. I have now applied the patch to move on with the other release items on my plate.