On Sat, Feb 01, 2003 at 09:29:24AM -0800, Brion Vibber wrote:
Jan has suggested having a summary table that keeps track of the counts, so we can access them directly. I'm inclined to agree; we could update it on page saves (and deletes and renames and undeletes!) to save the bother of the group/count/sort behemoth.
Yes. Every time you update the brokenlinks table you also have to update the wantedpages table, so that shouldn't be too hard to find in the code.
Something like:
CREATE TABLE wantedpages ( wanted_title varchar(255) binary NOT NULL default '', wanted_count int unsigned NOT NULL default 0, UNIQUE KEY wanted_title, INDEX wanted_count );
Index on the count, certainly, to speed the sort for the most wanted display. Index on the title should speed picking the right ones on updates, right?
Exactly. Btw., shouldn't namespace be in there somehwere or is that still a part of the title?
I suspect we can be smarter about how we update links and brokenlinks as well; currently we just delete every row pertaining to the page we're dealing with and re-insert it.
Probably, because when a page is saved you have to retrieve the "old" broken links from the DB anyway because there is no other way of knowing them and you need them to updated the wantedpages table. So you might as well compare them to the new list of broken links and remove/add only what has changed, which is usually only a few links anyway.
-- Jan Hidders