Discuție Modul:EditAtWikidata
Adăugare subiectAspect
Ultimul comentariu: acum 7 ani de Andrei Stroe
Hi @Strainu: and @Andrei Stroe:, In context of phab:T171027 and phab:T151717, Bawolff suggested that we should improve how we track wikidata usage to improve performance. As a power users here, you can improve it with a small trick in Wikidata lua modules - I did something similar in hewiki.
- Goal: Get wbc_entity_usage with X aspect to very small number (See hewiki graph from 2/9 to now we got from 200K to 11K today.
- How to do it:
- Try to avoid mw.wikibase.getEntity as much as possible in highly used modules
- For example in this module use mw.wikibase.getEntityIdForCurrentPage() instead of mw.wikibase.getEntityObject(qid).id
- To load specific statement use mw.wikibase.getBestStatements( 'Q1', 'P12' ) instead of mw.wikibase.entity:getBestStatements. For example Module:Authority control in hewiki with this trick.
- Practical tips:
- use Special:Formate_des_folosite to find the most important modules.
- You can track online on the changes in wbc_entity_usage by querying (from toolforge or from quarry)
select eu_aspect,count(*) from wbc_entity_usage group by eu_aspect;
ערן (discuție) 12 septembrie 2017 00:15 (EEST)
- Thanks for the input, ערן. Wow, does this mw.wikibase.getBestStatements thing actually avoid loading the entire item? It's what I was saying just yesterday. I did not know we finally have that. That's great news. We'll get on it. —Andreidiscuție 12 septembrie 2017 10:09 (EEST)
- Andrei: Currently it still loads the whole entity[1] on the server, but doesn't expose it (so later on wikibase could avoid it without breaking API). It only tracks other usages when accessing claims (e.g other = not sitelinks, and not labels). ערן (discuție) 12 septembrie 2017 13:07 (EEST)
- @ערן: I see. Still, this is brilliant. We could also use a function that could do the same tracking magic, but return all statements (or at least also statements with normal rank). We still have a few functions that could use this enhancement, but really need to look at claims that may not be of the preferred rank (even when a preferred claim exists). —Andreidiscuție 15 septembrie 2017 13:46 (EEST)
- Andrei: thank you. I see that following you changes we got down from 1.4M to 0.85M[2]
As for a function to load statements of any rank, it looks like there is no one yet, so for now you should keep using getEntity in such cases. Can you please file a task in phab:? You can use phab:T172905 as a template, and please give there an example for use-case. Please also add Hoo to the subscribers, who is the main owner for Lua binding of Wikidata. ערן (discuție) 15 septembrie 2017 14:19 (EEST)
- With that function now operational, we got it down to 455k and still dropping. —Andreidiscuție 25 octombrie 2017 18:45 (EEST)
- Andrei: thank you. I see that following you changes we got down from 1.4M to 0.85M[2]
- @ערן: I see. Still, this is brilliant. We could also use a function that could do the same tracking magic, but return all statements (or at least also statements with normal rank). We still have a few functions that could use this enhancement, but really need to look at claims that may not be of the preferred rank (even when a preferred claim exists). —Andreidiscuție 15 septembrie 2017 13:46 (EEST)
- Andrei: Currently it still loads the whole entity[1] on the server, but doesn't expose it (so later on wikibase could avoid it without breaking API). It only tracks other usages when accessing claims (e.g other = not sitelinks, and not labels). ערן (discuție) 12 septembrie 2017 13:07 (EEST)