humanmade / humanmade/authorship
Slow behaviour on admin-ajax requests
- Dominant language
- PHP
- Stars
- 68
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
I'm working with a customer who is experiencing slowness on admin-ajax requests, which appears to be at least partially attributable to Authorship.
For example, on a `query-attachments` action (sorted by highest impact):

The specific query here doesn't seem too strange:
{
"post_id": "1234",
"query": {
"post_mime_type": "image",
"paged": "1",
"posts_per_page": "80",
"orderby": "date",
"order": "DESC"
},
"action": "query-attachments"
}
However, this appears to be inefficiently querying the authors for these posts; there are 99 queries total, so approx 1 query per post (plus static overhead), where each query is:
SELECT DISTINCT t.term_id
FROM wp_4_terms AS t INNER JOIN wp_4_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_4_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE tt.taxonomy IN ('authorship') AND tr.object_id IN (4321)
ORDER BY tr.term_order ASC
Contributor guide
Assessment
This issue has not been assessed yet.