Lucas_Werkmeister_WMDE added a comment.

  Wait, I just realized the maintenance script isn’t enough. We need to do two 
things:
  
  - delete `wbt_item_terms` rows corresponding to deleted items
  - run maintenance script to remove now-unused terms
  
  If we just run the maintenance script on its own, it won’t do anything – all 
the term IDs we would pass to it are still referenced in `wbt_item_terms`, 
after all.
  
  Should this be another maintenance script (or added to the same maintenance 
script?), or should I try to run the correct `DELETE` SQL statements directly? 
Something like:
  
  name=on stats machine
    SELECT DISTINCT wbit_item_id
    FROM wbt_item_terms
    LEFT JOIN page
      ON page_namespace = 0
      AND page_title = CONCAT('Q', CAST(wbit_item_id AS CHAR))
    WHERE page_id IS NULL;
  
  
  
  name=on master db
    DELETE wbt_item_terms
    FROM wbt_item_terms
    LEFT JOIN page
      ON page_namespace = 0
      AND page_title = CONCAT('Q', CAST(wbit_item_id AS CHAR))
    WHERE page_id IS NULL
    AND wbit_item_id IN (...); -- list from stats machine

TASK DETAIL
  https://phabricator.wikimedia.org/T270249

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, Aklapper, Addshore, MisterSynergy, noarave, 
Akuckartz, Iflorez, alaa_wmde, Nandana, lucamauri, Lahi, Gq86, 
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Jonas, Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to