[wp-hackers] wp_list_authors and DB queries
Bob
wp-hackers at nj-arp.org
Wed Nov 21 22:41:05 GMT 2007
I wrote my own version of the widget/plugin. I hardcoded an array with the
author IDs to display, then called get_userdata() and get_usernumposts() in
a foreach loop. That cut the number of queries to 44, still 21 higher than
normal, and the time to 0.020 seconds more than normal.
That's an improvement over the generic plugin, but I was hoping for better.
I'd appreciate it if anyone has any more suggestions.
Bob
----- Original Message -----
From: "Computer Guru" <computerguru at neosmart.net>
To: <wp-hackers at lists.automattic.com>
Sent: Wednesday, November 21, 2007 11:16 AM
Subject: Re: [wp-hackers] wp_list_authors and DB queries
> It definitely should be possible to rewrite all that replacing those
> queries
> with just two or three depending on what the plugin does.
>
> Take a look at the database schema, study the code to see what it's trying
> to accomplish, and write your own query + result processor to get the job
> done. 117 is definitely unacceptable.
>
>
> On 11/21/07, Bob <wp-hackers at nj-arp.org> wrote:
>>
>> I just installed the wp-authors plugin, and the number of database
>> queries
>> to generate an HTML page went from 23 to 117(!), and the time required
>> increased by a full 1/10th second, a 40% increase.
>>
>> I have 50 users registered on my blog, but only 10 of them are
>> authors/editors/admins. It seems that wp_list_authors() is doing two
>> queries per user, even if they cannot write posts.
>>
>> Is there any way to reduce the number of queries? At worst case,
>> shouldn't
>> it be doing one query to get a list of users, then one query per user to
>> count the posts? That should be 51 extra queries not 94! Also, if I
>> could
>> have it only check users who can actually write posts, that would be
>> perfect.
>>
>> Bob
>>
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> Computer Guru
> Director,
> NeoSmart Technologies
> http://neosmart.net/blog/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list