r113206 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113205‎ | r113206 | r113207 >
Date:01:03, 7 March 2012
Author:catrope
Status:deferred
Tags:
Comment:
Create a unique index on afi_name, and force an index on the logging query
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/sql/ArticleFeedbackv5.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/sql/ArticleFeedbackv5.sql
@@ -71,7 +71,7 @@
7272 CREATE INDEX /*i*/article_feedback_timestamp ON /*_*/aft_article_feedback (af_created);
7373 CREATE INDEX /*i*/af_page_id ON /*_*/aft_article_feedback (af_page_id, af_created);
7474 CREATE INDEX /*i*/af_page_feedback_id ON /*_*/aft_article_feedback (af_page_id, af_id);
75 -CREATE INDEX /*_*/af_page_net_helpfulness_af_id ON /*_*/aft_article_feedback (af_page_id, af_net_helpfulness, af_id);
 75+CREATE INDEX /*i*/af_page_net_helpfulness_af_id ON /*_*/aft_article_feedback (af_page_id, af_net_helpfulness, af_id);
7676
7777 -- Allows for organizing fields into fieldsets, for reporting or rendering.
7878 -- A group is just a name and an ID.
@@ -93,6 +93,7 @@
9494 -- Which 'bucket' this field should be rendered in.
9595 afi_bucket_id integer unsigned NOT NULL
9696 ) /*$wgDBTableOptions*/;
 97+CREATE UNIQUE INDEX /*i*/afi_name ON /*_*/aft_article_field (afi_name);
9798
9899 -- Stores options for multi-value feedback fields (ie, select boxes)
99100 CREATE TABLE IF NOT EXISTS /*_*/aft_article_field_option (
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php
@@ -266,7 +266,13 @@
267267 __METHOD__,
268268 array(
269269 'LIMIT' => $limit + 1,
270 - 'ORDER BY' => 'log_timestamp DESC'
 270+ 'ORDER BY' => 'log_timestamp DESC',
 271+ // Force the page_time index (on _namespace, _title, _timestamp)
 272+ // We don't expect many if any rows for Special:ArticleFeedbackv5/foo that
 273+ // don't match log_type='articlefeedbackv5' , so we can afford to have that
 274+ // clause be unindexed. The alternative is to have the log_type clause be indexed
 275+ // and the namespace/title clauses unindexed, that would be bad.
 276+ 'USE INDEX' => 'page_time'
271277 )
272278 );
273279

Follow-up revisions

RevisionCommit summaryAuthorDate
r113377Followup r113206: this index can't be UNIQUE because we have duplicate values...catrope18:30, 8 March 2012

Status & tagging log