Show only used items option cause huge query in "cache_entity" table.

Created on 23 October 2024, about 2 months ago

Problem/Motivation

Show only used items option cause huge query in "cache_entity" table.

Steps to reproduce

Have a views for entity with bundle with lots of content.
The entity also have a relationship with file entities.
Use better exposed and selective better exposed filter.
Check Show only used items.

There is a query during the views rendering like this.

SELECT "cid", "data", "created", "expire", "serialized", "tags", "checksum" FROM "cache_entity" WHERE "cid" IN ( values:product_resource:419696, values:product_resource:419746, values:product_resource:427001, values:product_resource:392946, values:product_resource:392951, values:product_resource:426706, values:product_resource:422706, values:product_resource:392956, values:product_resource:412906, values:product_resource:424466, values:product_resource:424351, values:product_resource:422646, values:product_resource:426786, values:product_resource:385106, values:product_resource:385116, values:product_resource:385111, values:product_resource:385161, values:product_resource:385166, values:product_resource:385176, values:product_resource:385171, values:product_resource:385156, values:product_resource:422666, values:product_resource:422761, values:product_resource:424346, values:product_resource:425151, values:product_resource:425156, values:product_resource:425176, values:product_resource:425181, values:product_resource:304271 .... Thousands more here

Also this
SELECT "cid", "data", "created", "expire", "serialized", "tags", "checksum" FROM "cache_entity" WHERE "cid" IN ( values:file:473511, values:file:473516, values:file:480756, values:file:447031, values:file:447036, values:file:480461, values:file:476506, values:file:447026, values:file:466686, values:file:478231, values:file:478151, values:file:476461, values:file:480556, values:file:439366, values:file:439351, values:file:439356, values:file:439376, values:file:439381, values:file:439371, values:file:439386, values:file:439396, values:file:476486, values:file:476596, values:file:478091, values:file:478921, values:file:478916, values:file:478926, values:file:478931, values:file:365666, values:file:365676, values:file:365681, values:file:365686, values:file:365691, values:file:365671, values:file:365646, values:file:365656, values:file:365651, values:file:365661, values:file:431251, values:file:430091, values:file:430046, values:file:441856, values:file:441866, values:file:441876, values:file:441871, values:file:441861, values:file:431551, values:file:430071, values:file:430051, values:file:439346, values:file:439326, values:file:430076, values:file:430056, values:file:431556, values:file:431546, values:file:430061, values:file:430081, values:file:439336, values:file:371591, values:file:371576, values:file:371596, values:file:371606, values:file:430026, values:file:430096, values:file:439341, values:file:430576, values:file:430566, values:file:430571, values:file:430546, values:file:430551, values:file:430556, values:file:430561, values:file:430101, values:file:430031, values:file:371611, values:file:430086, values:file:430036, values:file:430066, values:file:430041, values:file:478981, values:file:428871, values:file:428846, values:file:441731, values:file:434696, values:file:441336, values:file:442381, values:file:422851, values:file:441316, values:file:441311, values:file:435566, values:file:435551, values:file:435556, values:file:435561, values:file:435376, values:file:435461, values:file:435391, values:file:435466, values:file:435436, values:file:435481, values:file:434711, values:file:435456, values:file:430001, values:file:441686, values:file:435396, values:file:435471, values:file:435441, values:file:435476, values:file:435451, values:file:434671, values:file:435446, values:file:429996, values:file:435511, values:file:435546, values:file:435516, values:file:435521, values:file:441321, values:file:435526, values:file:429066, values:file:429071, values:file:478976, values:file:441361, values:file:435536, values:file:435531, values:file:435541, values:file:433331, values:file:433351, values:file:429991, values:file:436056, values:file:478951, values:file:478991, values:file:478941, values:file:479001, values:file:423796, values:file:423816, values:file:419021, values:file:419031, values:file:423811, values:file:419026, values:file:419036, values:file:423806, values:file:423801, values:file:430171, values:file:461796, values:file:441726, values:file:434691, values:file:441341, values:file:442386, values:file:427576, values:file:435631, values:file:435636, values:file:381251, values:file:381241, values:file:381246, values:file:381236, values:file:435626, values:file:435611, values:file:435616, values:file:435621, values:file:432681, values:file:432676, values:file:441911, values:file:441901, values:file:441886, values:file:435381, values:file:442401, values:file:435416, values:file:434701, values:file:441681, values:file:435401, values:file:441906, values:file:435421, values:file:441891, values:file:434676, values:file:441896, values:file:441881, values:file:435571, values:file:435576, values:file:435581, values:file:435586, values:file:441326, values:file:435591, values:file:441366, values:file:435601, values:file:435596, values:file:435606, values:file:433336, values:file:433356, values:file:432556, values:file:441716, values:file:434686, values:file:441346, values:file:442391, values:file:430006, values:file:435386, values:file:435406, values:file:435426, values:file:434706, values:file:430011, values:file:441676, values:file:435411, values:file:435431, values:file:434681, values:file:441331, Thousands more here

I attached the query logs in the issue.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024