开发者

Is 154 MySQL Queries in 0.543 seconds a horrible thing?

I'm writing a wordpress newspaper theme. Because the theme makes use of multiple loops, it generates a lot of queries. Plus, I have to make many options dynamic because the theme will be released to the public (so I can't hardcode a lot of stuff).

On the front page, with a typical setup (a top story area, five newsboxes [that's five wordpress loops], a main menu, a secondary menu and a footer menu plus six sidebars) and NO plugins, the total query count is 154. I'm not sure if I'm allowed to post a link, but here is the page: http://pixelplanethemes.com/citizenpress/demo/

How is the loading time for you? The query count for me is 154 in 0.543 seconds (you can see the query count in the foot开发者_开发百科er). Sometimes the count is higher, but after I refresh it the number goes down to this.

I know this number is very high, but I have no idea how to reduce it because my programming skills are not very high. I've seen huge forums which have only 14 queries. My main question is, do you think this number is too high? Thanks for any advice.

I'm using WP_Query object to handle the multiple query loops. Is there a way to cache it without needing to use a plugin?


You have several other noticeable issues, including resizing pictures in HTML, instead of using thumbnail versions.

Load time for me (no cache, full load) is 9.89 seconds. That's dead slow.

Do I think 154 queries to render a front page is bad? Yes. WP is a pig but it's not that much of a pig.


I know this isn't exactly what you're looking for, but one of the easier ways to create fewer queries is to compile scripts instead of running queries for each individual data set. You probably don't have 100 tables, most likely only 20 or so. So what you would do is create a set of requests for data and then pull that data all at once through a single query instead of multiple queries before the page load.

Depending on your web host and bandwidth, that load time isn't too bad.

EDIT: However you have numerous other HTML issues as the other poster stated that are causing much larger lag times.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜