Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
entity system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Mar 2015 at 18:54 UTC
Updated:
30 Apr 2015 at 08:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jeroentComment #2
berdirThanks for creating this, I'd like some feedback from yched on this.
Comment #3
yched commented\Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFieldItems() does:
This means that the regular "load current revision" operation is ok with the primary key. But a "load a previous revision" operation (which, IIRC, is very frequent with workbench_moderation), wouldn't.
This case would probably be better handled with a dedicated multi-column index on "revision_id, deleted, delta, langcode", rather than currently two separate indexes on 'revision_id' and 'deleted'.
Then, it's possible that at some earlier point the index on 'deleted' was used for purging of deleted values. But currently \Drupal\Core\Entity\Sql\SqlContentEntityStorage::readFieldItemsToPurge() runs
- a first query to determine entity ids (using the index on 'bundle'),
- and then a second query to collect field values on those entity ids (which then uses the primary index)
so it looks like the index on 'deleted' is in fact useless now.
I'm not fully sure about existing queries that might use the 'langcode' index - waving to @plach for that :-)
Comment #4
plachI'm not aware of use cases for queries having conditions on the
langcodecolumn alone. Given its very low cardinality, thelangcodeindex seems pretty useless. Since Views joins dedicated tables based onentity_id,deletedandlangcodecolumns, a composite index with these three values would seem more useful to me.Makes sense to me too.
Btw, also the
bundleindex does not look very useful.Comment #5
Cinnead commentedComment #6
Cinnead commentedRemoved useless indexes.
Comment #7
Cinnead commentedComment #8
yched commentedSo,
- It's been established that 'revision_id' and 'deleted' are not needed anymore
- The index on 'bundles' is used by SqlContentEntityStorage::readFieldItemsToPurge() :
so I don't think we can remove it. Back to NW for that.
- According to #3 and #4, we would need new composite indexes. Let's do that in a separate issue - opened #2471635: Missing indexes on dedicated field tables
Comment #9
Cinnead commentedUpdated the patch to not remove 'bundle'
Comment #10
jeroentComment #11
yched commentedThanks, looks good to me :-)
RTBC if green.
Comment #12
jeroentRTBC when tests are green.
Comment #13
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed f364fc7 and pushed to 8.0.x. Thanks!