Bug #23528 Clarification Requested

Slow channel entries query with 15+ channel fields

Version: 4.1.1 Reporter: Andrew Gunstone

I suspect that this affect all EE4 versions … but I’ve found when adding a larger number of fields the channel entries queries run progressively slower. I currently have round 20 fairly basic fields for an “event” channel. I only have round 5 entries in the channel so far. I’m then using Low Search, but finding it incredibly slow (around 20+ seconds).

Using the debug info built into EE (yay!), I found the query was being called via Low Search:

$tagdata = $channel->entries();

This then led me to mod.channel.php … where I have changed some of the code (very bad to modify core I know!!) …

Line 2534 and line 2862 … change them both from:

$from .= "LEFT JOIN {$table} ON t.entry_id = {$table}.entry_id ";

to:

$from .= "LEFT JOIN {$table} FORCE INDEX(entry_id) ON t.entry_id = {$table}.entry_id ";

The query is now super fast. I’m not sure if it’s only because I have a low number of entries in the channel that MySQL (5.6.38) is not optimising the indexes automatically … but this change has made a dramatic difference.

Hope fully this (or a better solution if you know one!) can be rolled into core.

Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases