I’m trying to tune a wordpress website which suffers slow loading times, and I found out that the home page seems to take a lot more time to load. It’s not due to content because I’m just considering the time it takes for the base request to end (viewable via firebug in firefox).
Also I tried copying the index.php code in a custom page, and the same exact code loads in about Best Answerec while the main home loads in about 7. I noticed that single pages loaded faster, and at first I thought it was due to the difference in content, but after this test I’m not sure what’s causing this.
Is there much stuff that wordpress does behind the scenes only for the main index? Is there any other way to explain this situation and, more importantly, fix it so that the home page loads faster?
UPDATE — DIRTY SOLUTION
After a lot of blind tries, I created a new page called home which uses index.php
as custom template (not a copy, the same file). I redirected any call to the base path to it (via wordpress’ internal rewrite) and I have the same homepage as before, just loaded in 1/6th of the time. While I’m happy with the result, I’d really like to understand what’s going on.
ANOTHER UPDATE
So the point seems to be that I cannot use a dynamic (in wordpress’ sense) page with this site, it only works fine with a custom “static” page where I insert content via various functions, the normal Loop makes the home either very slow (with high memory limit) or just blank (low memory limit, script fails).
As suggested in this question, I created a static home linked to a custom page and it works fine. I also created a blog page (again with a custom template) which also works fine (where “fine” means it shows my empty test page containing just one word and no code) unless I specify it as “Posts page” in admin -> Reading settings. In other words it looks like as soon as wordpress sees a dynamic page (the one that’s supposed to hold The main Loop) it does something very heavy which eats up a lot of ram.
Still looking for the cause of this, I can work around it but I’d really like to understand what the problem is.
Edit: added bounty
More info: I tried disabling all plugins, wordpress is updated to the latest version.
FURTHER EDIT: TABLE INDEXES
wp_posts:
PRIMARY KEY (`ID`),
KEY `type_status_date` (`post_type`,`post_status`(1),`post_date`,`ID`),
KEY `post_status_date_gmt` (`post_status`(1),`post_date_gmt`),
KEY `post_date` (`post_date`),
KEY `post_date_gmt` (`post_date_gmt`),
KEY `post_parent` (`post_parent`),
KEY `post_name` (`post_name`),
KEY `post_status` (`post_status`),
KEY `post_author` (`post_author`),
FULLTEXT KEY `post_related` (`post_name`,`post_content`),
FULLTEXT KEY `post_content` (`post_content`,`post_title`),
wp_term_relationships:
PRIMARY KEY (`object_id`,`term_taxonomy_id`),
KEY `term_taxonomy_id` (`term_taxonomy_id`)
wp_term_taxonomy:
PRIMARY KEY (`term_taxonomy_id`),
UNIQUE KEY `term_id_taxonomy` (`term_id`,`taxonomy`),
KEY `taxonomy` (`taxonomy`)