#32449 closed defect (bug) (duplicate)
wp-admin/includes/template.php meta_form query is causing full table scans in wordpress 4.2
Reported by: | jeichorn | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | 4.2 |
Component: | Database | Keywords: | |
Focuses: | administration, performance | Cc: |
Description (last modified by )
It looks like the changes to indexes for utf8_mb4 is breaking this query.
SELECT meta_key FROM wp_postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\\_%' ORDER BY meta_key LIMIT 30
Its always doing a full table scan now. On a site with 7 million rows in postmeta this takes a long time.
I haven't been able to come up with a solution to force mysql to use the index.
I've included a patch fixes the performance problem, but i'm not sure how much use this feature is in general. On the site in question there are 10k distinct meta keys that don't start with _, what does showing a random 30 of them buy anyone?
Attachments (1)
Change History (11)
#1
@
10 years ago
- Component changed from General to Posts, Post Types
- Focuses administration added
- Version changed from 4.2.2 to 4.2
#2
@
10 years ago
I have verified that the updated query in #24498 does not improve performance in 4.2.
#3
follow-up:
↓ 6
@
10 years ago
- Component changed from Posts, Post Types to Database
I have verified that the updated query in #24498 does not improve performance in 4.2.
I'm seeing the opposite, it appears to restore the index usage, and is faster.
#7
follow-up:
↓ 8
@
9 years ago
- Focuses performance added
- Severity changed from normal to major
I don't get any improvement from the patch but the table scan on wp_postmeta blocks the database and making one of my clients sites inaccessible in seconds.
I suggest this ticket should have higher severity. On larger sites with lots of traffic and big wp_postmeta this can kill the db in seconds.
It should definitely be tagged with performance in any circumstance.
#8
in reply to:
↑ 7
@
9 years ago
Replying to jstensved:
I don't get any improvement from the patch but the table scan on wp_postmeta blocks the database and making one of my clients sites inaccessible in seconds.
I suggest this ticket should have higher severity. On larger sites with lots of traffic and big wp_postmeta this can kill the db in seconds.
It should definitely be tagged with performance in any circumstance.
If you drop the distinct from the patch it will solve your clients issues, it just reduces the changes of producing 30 items.
Patch for wp-admin/includes/template.php