- Affected version
- 1.x
xf_post has the following indexes related to post_date or thread_id
Semi-modern versions of MySQL can do partial index matches, which means there are 2 indexes which can match thread_id, and 2 indexes which can match post_date if thread_id is available.
ie
with post_date column match post_date index
with post_date, thread_id column match post_date or thread_id_post_date index
with thread_id column match thread_id_position or thread_id_post_date index
Dropping post_date and reordering columns:
ie
with post_date column match post_date_thread_id index
with post_date, thread_id column match post_date_thread_id index
with thread_id column match thread_id_position or thread_id_post_date index.
This should improve insert performance (less indexes to update), and slightly improve diskspace usage.
This affects XF2 as well.
Code:
KEY thread_id_post_date (thread_id, post_date),
KEY thread_id_position (thread_id, position),
KEY post_date (post_date)
ie
with post_date column match post_date index
with post_date, thread_id column match post_date or thread_id_post_date index
with thread_id column match thread_id_position or thread_id_post_date index
Dropping post_date and reordering columns:
Code:
KEY post_date_thread_id (post_date, thread_id),
KEY thread_id_position (thread_id, position),
with post_date column match post_date_thread_id index
with post_date, thread_id column match post_date_thread_id index
with thread_id column match thread_id_position or thread_id_post_date index.
This should improve insert performance (less indexes to update), and slightly improve diskspace usage.
This affects XF2 as well.