Allow fields to be opted out of views data

Created on 12 June 2024, 3 months ago
Updated 14 June 2024, 3 months ago

Problem/Motivation

The views data cache is one of the most expensive caches to build, and one of the largest runtime caches to store/load in APCu. See notes and timings in #3257725-25: [PP-1] Add a cache prewarm API and use it to distribute cache rebuilds after cache clears / during stampedes β†’ and downwards. Also see πŸ› ViewsData should not cache by language Needs work for different ideas on how to possibly optimize views data.

Many sites have over 200 field config entities, I have seen sites with over 1,000 field config entities. The more fields on a site, the worse things get.

However, many fields aren't used in views data at all, although this tends to be site-specific, but for example it's years since I've used a 'body' field in views. Or any of the fields on a block content entity for example.

Steps to reproduce

Proposed resolution

Views could add a third party setting to field config entities like 'provide_views_data', default this to TRUE, but when it's FALSE, don't provide views data for that field (no field, no filter, no argument etc.)

If a site needs views data for the field after all, they can change the flag.

If the flag is enabled, you can switch it off, but we can check against config dependencies of views on the site (the same as we could if it was being deleted) and prevent this from happening when a field is being used.

This would be an extra checkbox on field settings, or maybe even a config key with no UI, but it would give us tools to reduce bloat in the views data cache.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom catch

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024