Tim Starling wrote:
For some reason (probably some theory of
Jamesday's about great ways to
optimise selects on single-row tables), the query for the
{{NUMBEROFARTICLES}} tag looks like this:
$s = $dbr->selectRow( 'site_stats',
array( 'ss_total_views', 'ss_total_edits', 'ss_good_articles'
),
array( 'ss_row_id' => 1 ), $fname
i.e. using the new primary key in a way that's always meant to match.
For this latest batch of wikis, I created the site_stats row using:
INSERT INTO site_stats() VALUES ()
which creates a row with default values in every column. The default for
ss_row_id is 0. I'll fix this on these wikis shortly, I just thought it
was a nice example of the problems you can get when you optimise things
that don't really need optimising.
Well, that table's only ever had one row, but it does *have* a key and
there was some theory about storing multiple rows over time that never
happened. :)
-- brion vibber (brion @
pobox.com)