Opened 3 years ago
Closed 5 months ago
#11423 closed enhancement (fixed)
user_nicename should get memcached
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | Optimization | Version: | 2.9 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
When displaying an author's page, there are queries:
SELECT ID FROM users WHERE user_nicename='whoever' SELECT display_name FROM users WHERE user_nicename = 'whoever'
the second one could be avoided with a non-persistent cache bucket indexed on user_nicename. we could store the user_id, for instance.
both of them could be avoided with the same bucket if the latter is made persistent.
Attachments (2)
Change History (15)
Denis-de-Bernardy — 3 years ago
- Keywords has-patch added
I did not look into the code but couldn't both values (ID, display_name) selected with one query? Wouldn't that solve the job as well?
something like merging
SELECT ID FROM users WHERE user_nicename='whoever' SELECT display_name FROM users WHERE user_nicename = 'whoever'
into
SELECT ID, display_name FROM users WHERE user_nicename = 'whoever'
Replying to hakre:
something like merging
SELECT ID FROM users WHERE user_nicename='whoever'
SELECT display_name FROM users WHERE user_nicename = 'whoever'
into
SELECT ID, display_name FROM users WHERE user_nicename = 'whoever'
Those queries are in separate files.
not sure what you guys are discussing... the suggested patch strips the two queries already with memcached enabled. :-)
- Keywords commit added
this has been used on a live site for months.
- Keywords needs-refresh added; commit removed
- Milestone changed from 3.0 to Future Release
Due to [14160]
comment:10
xibe — 3 years ago
- Keywords dev-feedback needs-testing added; needs-refresh removed
- Milestone changed from Future Release to 3.0
comment:11
nacin — 3 years ago
- Milestone changed from 3.0 to Future Release
comment:12
ocean90 — 5 months ago
- Keywords close added; dev-feedback needs-testing removed
From general-template.php:
// If there's an author
if ( is_author() ) {
$author = get_queried_object();
$title = $author->display_name;
}
get_queried_object() calls get_userdata() which calls get_user_by(). get_user_by() does the caching, see [10992].
comment:13
SergeyBiryukov — 5 months ago
- Keywords close removed
- Milestone changed from Future Release to 3.1
- Resolution set to fixed
- Status changed from new to closed
Fixed in [15598].

actually, it does get memcached:
so we should use it in WP query and for the display_name.