-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate query IDs with the hint table
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: - Less bloat in the hint table, as query strings are replaced by bigint to track the query ID associated with a hint. - Less work for the module itself. Query normalization consumes cycles to apply the constants to the string for the match in the hint table. The longer the string, the longer it takes to apply the normalization. This code was copy-pasted from pg_stat_statements, and there is no need for it anymore. This also means less long-term technical debt to keep this code in line with upstream. - Less error-prone, as a type in the data inserted in the hint table could easily cause a mismatch fail when looking for an entry. Regression tests are adjusted to cope with this commit, where a PL/PgSQL function is added, to be able to retrieve the query ID from a query string, wrapped around 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: - pg_hint_plan.sql has been switched to use this wrapper, with no changes in the regression test coverage. - ut-A, similarly, switches to use the function to retrieve query IDs. A use-case was becoming useless, where we checked for two hints set for the same query ID computed. - ut-T included two tests with CTAS and DECLARE, which interact badly with the PL wrapper. These could be covered with pg_stat_statements, but this dependency is planned to be removed entirely, and they covered edge cases with limited value at the end. 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. Per pull request #193.
- Loading branch information
Showing
17 changed files
with
171 additions
and
529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.