Last modified: 2012-04-23 16:49:38 UTC
Created attachment 9439 [details] changed queries The WantedQueryPages (WantedPages, WantedTemplates, WantedCategories and WantedImages) are showing often ghost entries. Purging the entries is possible (bug 16112) but not down regularly on all wikis. I have modify the queries of that 4 special page to count only existing pages. Than this ghost entries are gone from the special page output. To reach this, the query has to join a second time to the page table to check the *_from fields of existing in the page table. All special pages are expensive. I hope, the change makes the special pages not too expensive and they can stay on wmf wikis. Feel free to modify the patch. Thanks.
Minor point (not wrong), but as NS_CATEGORY is known to be a number constant, quoting isn't needed, but you're not adding it, just making it database agnostic
In my opinion it is better to set up a cron job to fix this (bug 16112 comment 17), because other query pages also affected by the ghost entries, but due to a low count of that, you will not see the ghost entries in the result of Special:MostLinkedPages (for example).
maintenance script now runs periodically (on wmf), no need for this change, from my point of view. Feel free to commit the patch, if you think, that it is a good thing, but that can make the queries more expensive.