"Raindrift" posted a comment on MediaWiki.r109216.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/109216#c29951

Commit summary for MediaWiki.r109216:

Surfacing MarkAsHelpful on FeedbackDashboard page

Raindrift's comment:

To answer the question in your comment: since INNER JOIN is the default, you 
could probably put 'mbfr_mbf_id = mbf_id' in $conds, add 'moodbar_feedback' to 
$table, and remove $tableJoin['moodbar_feedback'] altogether.  That is, place 
the join condition in the where clause like with the other two tables.  That 
is, unless you're specifically relying on INNER JOIN's higher precedence to 
make the LEFT JOIN work against the correct table, but it doesn't seem that 
way...  the ON clause should handle it (does this even make sense?)

Aside from that, this looks good, except that I think you may want to poke at 
the indices a little.  I'll go one table at a time:

moodbar_feedback: queries against (mbf_user_id, mbf_id), but I don't think 
there's a concatenated index that begins with those two columns.

moodbar_feedback_response: queries against (mbfr_id, mbfr_user_id, 
mbfr_mbf_id), same as above, I can't find an index that covers all of them.

mark_as_helpful: queries against (mah_type, mah_item, mah_user_id), looks good, 
'mah_type_item_user_id' covers it.

user: just user_id, which is indexed, of course.  :)

Some of these tables have a lot of indices already, and I bet you could extend 
an existing index to do what you want rather than adding a new one.  For 
example, the 'mbfr_mbf_mbfr_id' index could just have 'mbfr_user_id' tacked on 
the end.

It's also possible that this doesn't matter because the intersection of 
non-indexed rows will be small.  I haven't actually run an EXPLAIN on the query 
with a real dataset...


_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to