So, now that we've applied #3094497: Performance: cache version number locally, we look at Schema::queryColumnInformation() and see it taking 22.9% of our time. Let's cache that sucker!

This one's a little more dangerous than caching the server version, I recognize, and you might not want to merge this (at least, not without making it a non-default driver option) - it's possible that schema changes could be made in another connection/process making this local cache stale. On the other hand, the odds that such a change would make a difference in the actual execution with the caching but be harmless without the caching seem slim...

CommentFileSizeAuthor
sqlsrv-cache-column-info.patch1.41 KBmikeryan

Comments

mikeryan created an issue. See original summary.

mikeryan’s picture

beakerboy’s picture

Thank you for the patch. I plan on reviewing it soon. If this were a non-default driver option, how would like to see the user enabling or disabling the option? If it is through the module settings configuration, I would appreciate you adding that to the patch.

beakerboy’s picture

Assigned: Unassigned » beakerboy
beakerboy’s picture

Good idea. One improvement may be a flag that can be set by the changeFoo() functions. This way, if a connection changes a table, that connection will update the cache the next time queryColumnInformation() is called. Can a static property be used to flag the need to update across all connections? The way this is currently written, core tests will probably fail when the changeTable and changeField methods are tested in core Kernel tests.

beakerboy’s picture

Better idea. Every time a schema function perform an “ALTER TABLE” query, or anything that changes the schema, unset the appropriate entry in the columnInformation array. Also, provide a public method to unset the element in case a user changes the schema with a static query.

beakerboy’s picture

Most of the time, the only piece of this information that is actually used is the list of blobs. I wonder if things would speed up if we just queried for the blobs instead of the entire table's schema.

beakerboy’s picture

WOW! I just implemented this, and it dropped the time to run the entire Drupal test suite in Travis-ci from 6 hours down to 4.5. By consolidating tests to reduce the number of containers I'm spinning up, I can drop it to 4 hours.

beakerboy’s picture

Status: Needs review » Fixed

Added this as a feature that can be enabled by users when installing.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.