#15170 closed defect (bug) (fixed)
Network admin pages don't scale
Reported by: | ryan | Owned by: | ryan |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Multisite | Keywords: | ongoing-project |
Focuses: | Cc: |
Description (last modified by )
network/sites.php and network/users.php do queries like:
SELECT COUNT(wp_trunk_users.ID) FROM wp_trunk_users WHERE 1=1 SELECT COUNT( blog_id ) FROM wp_trunk_blogs WHERE site_id = '1'ORDER BY wp_trunk_blogs.blog_id ASC
These are very slow on large networks. get_blog_count() and get_user_count() would mitigate this somewhat, although they too can cause problem on large networks.
Perhaps users.php and sites.php should consult get_user_count() and get_blog_count() and not do a query if the count is over a certain threshold. The tables would default to being empty and a search would have to be performed to get results.
Further, a large network flag may be needed so that functions like get_blog_count() and get_user_count() can avoid ever running COUNT queries and instead rely on the network administrator to perform counts and populate the count site options via a separate job.
Attachments (3)
Change History (32)
#4
@
14 years ago
- Keywords iceberg added
- Owner set to ryan
- Status changed from new to assigned
Applying new tag, "iceberg," for tickets that will have multiple commits over time before they are expected to be closed as finished.
#5
@
14 years ago
- Keywords ongoing-project added; iceberg removed
Who am I kidding? The (tip of the) iceberg tag sounds cool and funny to those of us in here all the time, but new contributors will be confused. New tag will be ongoing-project.
#6
@
14 years ago
Patch changes sites.php to show the latest x registered sites without paging to avoid expensive COUNT queries. I wanted to show nothing so we wouldn't need to do a query that is probably throw away, but showing nothing results in the table markup not being output which will break AJAX search requests which expect the table to already be there. So, this is a compromise.
#8
@
14 years ago
$query .= " AND ( {$wpdb->blogs}.domain LIKE '%{$like_s}%' OR {$wpdb->blogs}.path LIKE '%{$like_s}%' ) ";
That is a killer query on large sites. We should probably lose the %s and saerch for $like_s.domain for subdomain installs and domain/$like_s for subdir installs.
#16
@
14 years ago
$wild = 'true';
should be
$wild = true;
for data type consistency, in line 451 of wp-includes/user.php in [16170].
#24
@
14 years ago
That loses some flexibility but greatly improves performance. WIll look at a better fix later.
#25
@
14 years ago
Trailing wildcard searches were added in [16170]. Could we also allow wildcard user searches such as *gmail.com?
Related: #15053