Problem/Motivation
On PostgreSQL, every insert, update and upsert query calls Schema::queryTableInformation() to find the blob and serial columns of the target table. Each call runs a catalog query. A request pays one catalog query per table it writes to, on every request.
Proposed resolution
Add a TableInformationLoader that collects the information for all tables of a connection with one catalog query. Cache the result in the bootstrap cache bin. Delete the cached information on every schema change.
Each connection owns one loader, available through Connection::tableInformation(). The insert, update and upsert queries and the schema object use it. Temporary tables and tables created after the load are introspected individually. The information collected during a transaction is not persisted, because PostgreSQL DDL is transactional.
The pgsql.table_information_prewarmer service prewarms the cache of the default connection.
Remaining tasks
Review.
API changes
New public method Connection::tableInformation() on the pgsql driver. New service pgsql.table_information_prewarmer. Schema::queryTableInformation() delegates to the loader.
Data model changes
None.
For the committer
The changes to the .gitlab-ci.yml file need to be removed before merging!
| Comment | File | Size | Author |
|---|
Issue fork drupal-3615649
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mondrakeComment #4
daffie commentedThe CI pipeline failures for PostgreSQL are not related to the changes in the PR.
Ready for a review.
Comment #5
daffie commentedComment #6
daffie commentedDisclosure: I have used AI on the PR, the IS and the CR.
Comment #7
smustgrave commented1 comment on the MR.
Comment #8
daffie commentedRebased the PR and responded to remark from @smustgrave.
Comment #9
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #10
daffie commentedRebased the MR