[wp-hackers] get_userdata and _fill_user causing huge number of database queries

Dion Hulse (dd32) wordpress at dd32.id.au
Wed Mar 3 21:42:27 UTC 2010

This question really needs some more information before anyone can really  
comment on that.

The main question is WHY are the queries being made for the author details  
when viewing the singular page.

Do you have a listing of all the authors on the page? If so, thats  
probably what it is, it needs to load all the details for the users to  
display it.

Check the query log, specifically, what functions are calling it. If you  
enable WP_DEBUG and SAVE_QUERIES, then look at $wpdb->queries, you'll see  
the full list of queries, and what functions called it (with a backtrace  
too), Looking at that should help determine which function is calling the  
user list, if thats not enough, you might be able to rewrite something to  
use the new functions mentioned in that changeset..

On Thu, 04 Mar 2010 08:16:56 +1100, Andrew Nacin <wp at andrewnacin.com>  

> From about two hours ago:
> http://core.trac.wordpress.org/changeset/13576
> On Wed, Mar 3, 2010 at 4:13 PM, Simon B <piemanek at gmail.com> wrote:
>> I've made a site for a member organisation with (currently) 50 users,  
>> each
>> of whom has one post (a kind of profile post).
>> When monitoring the site I noticed that a lot more database queries  
>> than I
>> expected were being made. On investigation it turns out that for every  
>> post
>> retrieved, the following two db queries are made: get_userdata and
>> _fill_user. The first is on the users table, the second on usermeta.
>> This means that where I was expecting one query there are in fact 101!  
>> When
>> they get more members things are going to get very painful indeed...
>> Is there any way I can hook into an action somewhere to stop these two
>> queries from happening, as I have no use whatsoever for the data they're
>> returning?
>> Cheers
>> Simon
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

Dion Hulse / dd32

  e: contact at dd32.id.au
  msn: msn at d32.id.au
  skype: theonly_dd32
  Web: http://dd32.id.au/

More information about the wp-hackers mailing list