Page MenuHomePhabricator

SpecialWikibaseQueryPage has no caching
Open, NormalPublic

Description

For starters, SpecialWikibaseQueryPage has no caching.

It's also apparently a wheel re-inventing, subclassing SpecialWikibasePage. Not anything to do with QueryPage in core. Which has marking things as expensive. Caching. Yada yada

Details

Reference
bz65168

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:18 AM
bzimport set Reference to bz65168.
bzimport added a subscriber: Unknown Object (MLST).
Reedy created this task.May 10 2014, 10:29 PM

Is not related to the Wikibase Query functionality.

Subclassing like this is also bad design wise

Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).

Is this still current?

Is this still current?

I don't think anyone touched this part of the code since 2014?

Yes, Right now three special pages use SpecialWikibaseQueryPage:

  • SpecialEntitiesWithoutPage
  • SpecialListProperties
  • SpecialItemsWithoutSitelinks

And three use QueryPage:

  • SpecialEntityUsage
  • SpecialUnconnectedPages
  • SpecialPagesWithBadges

(These three are actually recently writte/rewritten)

Making SpecialWikibaseQueryPage subclass QueryPage and enable proper caching (IIRC @Anomie said caching in QueryPage is actually enabled when 'value' field is added to the query spec, otherwise it's useless. There might be more to it. He knows better)
Here's my suggestion: Let's abandon SpecialWikibaseQueryPage and use QueryPage in these three classes instead. We probably need to rewrite most parts to get it done properly (so we would have caching). But that's definitely something that other Wikidata developers should comment too.

*cough* composition *cough* framework decoupling *cough*

(IIRC @Anomie said caching in QueryPage is actually enabled when 'value' field is added to the query spec, otherwise it's useless. There might be more to it. He knows better)

QueryPage's caching associates a namespace+title with an integer. So while it's not clearly mentioned in the inline documentation, for things to work properly your code needs to degrade gracefully when fields other than namespace, title, and value aren't present in the result set.

QueryPage also has support built in for using a timestamp as value by converting it to a Unix epoch value, although in that mode it looks like the current schema only supports 1970-01-01T00:00:00Z to 2106-02-07T06:28:15Z.