The root cause [IIRC] for introducing SchemaCache (or rather its D7 equivalent) was
Avoid to load .install files, because they can be big, and we need the table schema info all over the place.
— But in D8, database table schema information should not be needed anymore.
Only the installer + module install/uninstall should need it. In addition, work is actively ongoing to remove schema definitions for entity type base tables from hook_schema() and derive that info from the base field definitions instead.
→ Drop the schema cache altogether and just simply load the .install file of the requested module + invoke its hook_install() at all times.
→ Convert schema.inc into a trivial new Schema class/service.
The primary blockers/offenders are:
For (1), I created #1774104: Replace all trivial drupal_write_record() calls with db_merge() a very long time ago already, because drupal_write_record() is definitely replaced by all the (base) field work in D8.
The vast majority of calls to (2) are tests.
The calls to (3) are almost exclusively originating from Entity/Field code. @tstoeckler + @andypost + Co are currently working to fill in some last remaining gaps in that space, with the goal of completely replacing hook_install() for all entity types, since the information can be derived from base field definitions.
Instead of a manually curated table here, please refer to the list of child issues in the sidebar →
Comments
Comment #1
sunComment #2
catchThis should have a decent impact on performance (especially memory usage) when caches are rebuilt - loading all install files, building the schema array for 300-400 tables then caching it is very expensive.
Comment #3
sunThe first clean-up issue is ready: #1774104: Replace all trivial drupal_write_record() calls with db_merge()
Comment #4
berdir@catch: We no longer have 300-400 tables in hook_schema(). See updated issue summary in #2185015: Remove SchemaCache and CacheArray. With field tables gone from there, cache tables gone, lots of tables gone that are now config entities, #1498720: [meta] Make the entity storage system handle changes in the entity and field schema definitions aiming to remove content entity tables, the schema cache will be *much* smaller.
Comment #5
berdirdrupal_write_record(): Apparently unused outside of WriteRecordTest in core :)
drupal_schema_fields_sql(): Apparently unused as well.
drupal_get_schema(): Mostly removed from runtime usage as far as I can see, main usage is around installing tables and cache clears ;)
Posted a patch to #2194885: Remove drupal_write_record() that removes the first two.
I think we can close this?
Comment #6
berdirIf nobody speaks up then I'm going to do exactly that.