Opened 19 years ago
Closed 18 years ago
#2604 closed defect (bug) (fixed)
SQL Query Optimization
Reported by: | ryan | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | 2.0.2 |
Component: | Administration | Keywords: | sql db performance |
Focuses: | Cc: |
Description
Improvements suggested by Domas Mituzas.
Attachments (4)
Change History (15)
#3
@
19 years ago
Removing DISTINCT from the main post query resulted in a 6% performance improvement over current trunk. Benchmarked 500 requests using apache bench. The exact same front page was used for each run. Document length was 22205 bytes. This is with the default theme and the default install options. Imported the same 225 posts for each to prime the test with some realistic blog posts.
#4
@
19 years ago
Removing DISTINCT and GROUP BY gives a 10% performance increase over baseline. Same test environment.
#5
@
19 years ago
Added composite key (post_type, post_status, post_date) and shortened post_type from 100 to 20. Didn't make a difference to performance.
#7
@
19 years ago
Just to note, we've already removed timestamps from queries and only check for a post_status of publish in the main post query. No more checks for static.
#8
@
19 years ago
these two queries: 66 Query SELECT * FROM wp_categories WHERE cat_ID > 0 HAVING category_count > 0 ORDER BY cat_name asc 66 Query SELECT * FROM wp_categories WHERE cat_ID > 0 HAVING link_count > 0 ORDER BY cat_name ASC could possibly be rewritten into link_count>0 or category_count>0
Anyone want to tackle this part? Eliminate "HAVING". Look in get_categories().
http://p.defau.lt/?tiJutSuV86iBJfUPGq_h0g
http://p.defau.lt/?_hp_YagOMRNnFgeXdhpbpw
http://p.defau.lt/?DRnl1EN_6SB7UhBfgzLdrw