Currently, we query the constraints table for the constraints on a property every time we check constraints for a property. If an entity has multiple statements with the same property, or if an API request checks several entities at once, this can results in several identical, redundant requests. To optimize constraint checking, we should only query the constraints once per property.
Description
Description
Details
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Cache constraints for property | mediawiki/extensions/WikibaseQualityConstraints | master | +79 -1 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | Lucas_Werkmeister_WMDE | T173695 Enable constraint checks by default for users | |||
Open | None | T103228 Improve performance of constraint check | |||
Resolved | Lucas_Werkmeister_WMDE | T89349 [Task] Only query constraints table once per property |
Event Timeline
Comment Actions
It’s still valid, but I think there are two fairly separate tasks here.
- We currently query the database for constraints on a property every time we check constraints on a property, which can be several times per request if there are several statements of the same property on an item, or if an API request includes several items. (This currently happens in DelegatingConstraintChecker::checkStatement and ConstraintRepository::queryConstraintsForProperty.) I imagine we could introduce some caching ConstraintLookup.
- Some constraints, like “has type” (type) or “has statement” (item), are really constraints on the item, not on the statement; if multiple statements all introduce the same constraint on the item (for example, parent, sibling, date of birth, etc. might all require type: human), it only needs to be checked once. This seems like a more fundamental change to me, and unrelated to the first task, which is purely technical.
Comment Actions
I’ve created T163683 for the second point and edited this task to reflect the first point.
Comment Actions
Change 349949 had a related patch set uploaded (by Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Cache constraints for property
Comment Actions
Change 349949 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Cache constraints for property