Index: trunk/extensions/MoodBar/sql/mbf_timestamp.sql |
— | — | @@ -1,5 +0,0 @@ |
2 | | - |
3 | | -CREATE INDEX /*i*/mbf_userid_ip_timestamp ON /*_*/moodbar_feedback (mbf_user_id, mbf_user_ip, mbf_timestamp); |
4 | | -CREATE INDEX /*i*/mbf_type_userid_ip_timestamp ON /*_*/moodbar_feedback (mbf_type, mbf_user_id, mbf_user_ip, mbf_timestamp); |
5 | | -CREATE INDEX /*i*/mbf_timestamp ON /*_*/moodbar_feedback (mbf_timestamp); |
Index: trunk/extensions/MoodBar/sql/MoodBar.sql |
— | — | @@ -26,9 +26,9 @@ |
27 | 27 | ) /*$wgDBTableOptions*/; |
28 | 28 | |
29 | 29 | -- A little overboard with the indexes perhaps, but we want to be able to dice this data a lot! |
30 | | -CREATE INDEX /*i*/type_timestamp ON /*_*/moodbar_feedback (mbf_type,mbf_timestamp); |
31 | | -CREATE INDEX /*i*/title_type ON /*_*/moodbar_feedback (mbf_namespace,mbf_title,mbf_type,mbf_timestamp); |
32 | | -CREATE INDEX /*i*/mbf_userid_ip_timestamp ON /*_*/moodbar_feedback (mbf_user_id, mbf_user_ip, mbf_timestamp); |
33 | | -CREATE INDEX /*i*/mbf_type_userid_ip_timestamp ON /*_*/moodbar_feedback (mbf_type, mbf_user_id, mbf_user_ip, mbf_timestamp); |
34 | | -CREATE INDEX /*i*/mbf_timestamp ON /*_*/moodbar_feedback (mbf_timestamp); |
| 30 | +CREATE INDEX /*i*/mbf_type_timestamp_id ON /*_*/moodbar_feedback (mbf_type,mbf_timestamp, mbf_id); |
| 31 | +CREATE INDEX /*i*/mbf_title_type_id ON /*_*/moodbar_feedback (mbf_namespace,mbf_title,mbf_type,mbf_timestamp, mbf_id); |
| 32 | +-- CREATE INDEX /*i*/mbf_namespace_title_timestamp ON /*_*/moodbar_feedback (mbf_namespace, mbf_title, mbf_timestamp, mbf_id); --maybe in the future if we actually do per-page filtering |
| 33 | +CREATE INDEX /*i*/mbf_userid_ip_timestamp_id ON /*_*/moodbar_feedback (mbf_user_id, mbf_user_ip, mbf_timestamp, mbf_id); |
| 34 | +CREATE INDEX /*i*/mbf_type_userid_ip_timestamp_id ON /*_*/moodbar_feedback (mbf_type, mbf_user_id, mbf_user_ip, mbf_timestamp, mbf_id); |
| 35 | +CREATE INDEX /*i*/mbf_timestamp_id ON /*_*/moodbar_feedback (mbf_timestamp, mbf_id); |
Index: trunk/extensions/MoodBar/sql/mbf_timestamp_id.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +-- Add some indexes to the moodbar_feedback table |
| 3 | + |
| 4 | +CREATE INDEX /*i*/mbf_userid_ip_timestamp_id ON /*_*/moodbar_feedback (mbf_user_id, mbf_user_ip, mbf_timestamp, mbf_id); |
| 5 | +CREATE INDEX /*i*/mbf_type_userid_ip_timestamp_id ON /*_*/moodbar_feedback (mbf_type, mbf_user_id, mbf_user_ip, mbf_timestamp, mbf_id); |
| 6 | +CREATE INDEX /*i*/mbf_timestamp_id ON /*_*/moodbar_feedback (mbf_timestamp, mbf_id); |
Property changes on: trunk/extensions/MoodBar/sql/mbf_timestamp_id.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: trunk/extensions/MoodBar/sql/AddIDToIndexes.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +-- Drop and recreate indexes to add mbf_id to the end |
| 3 | +DROP INDEX /*i*/type_timestamp ON /*_*/moodbar_feedback; |
| 4 | +DROP INDEX /*i*/title_type ON /*_*/moodbar_feedback; |
| 5 | +CREATE INDEX /*i*/mbf_type_timestamp_id ON /*_*/moodbar_feedback (mbf_type,mbf_timestamp, mbf_id); |
| 6 | +CREATE INDEX /*i*/mbf_title_type_id ON /*_*/moodbar_feedback (mbf_namespace,mbf_title,mbf_type,mbf_timestamp, mbf_id); |
\ No newline at end of file |
Property changes on: trunk/extensions/MoodBar/sql/AddIDToIndexes.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: trunk/extensions/MoodBar/sql/AddIDToIndexes2.sql |
— | — | @@ -0,0 +1,5 @@ |
| 2 | +-- Drop and recreate indexes to add mbf_id to the end |
| 3 | +DROP INDEX /*i*/mbf_userid_ip_timestamp ON /*_*/moodbar_feedback; |
| 4 | +DROP INDEX /*i*/mbf_type_userid_ip_timestamp ON /*_*/moodbar_feedback; |
| 5 | +DROP INDEX /*i*/mbf_timestamp ON /*_*/moodbar_feedback; |
| 6 | +-- Recreation is done in mbf_timestamp_id.sql |
Property changes on: trunk/extensions/MoodBar/sql/AddIDToIndexes2.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 7 | + native |
Index: trunk/extensions/MoodBar/MoodBar.hooks.php |
— | — | @@ -75,8 +75,18 @@ |
76 | 76 | 'mbf_user_editcount', dirname(__FILE__).'/sql/mbf_user_editcount.sql', true ) |
77 | 77 | ); |
78 | 78 | |
| 79 | + $db = $updater->getDB(); |
| 80 | + if ( $db->indexExists( 'moodbar_feedback', 'type_timestamp', __METHOD__ ) ) { |
| 81 | + $updater->addExtensionUpdate( array( 'addIndex', 'moodbar_feedback', |
| 82 | + 'mbf_type_timestamp_id', dirname( __FILE__ ) . '/sql/AddIDToIndexes.sql', true ) |
| 83 | + ); |
| 84 | + } |
| 85 | + $updater->addExtensionUpdate( array( 'dropIndex', 'moodbar_feedback', |
| 86 | + 'mbf_timestamp', dirname( __FILE__ ) . '/sql/AddIDToIndexes2.sql', true ) |
| 87 | + ); |
| 88 | + |
79 | 89 | $updater->addExtensionUpdate( array( 'addIndex', 'moodbar_feedback', |
80 | | - 'mbf_timestamp', dirname( __FILE__ ) . '/sql/mbf_timestamp.sql', true ) |
| 90 | + 'mbf_timestamp_id', dirname( __FILE__ ) . '/sql/mbf_timestamp_id.sql', true ) |
81 | 91 | ); |
82 | 92 | |
83 | 93 | return true; |