Main | Search

Question
Sort: Ascending / Descending
How can I reduce the load generated by MySQL?
How do i get even faster page generation?

Answer
How can I reduce the load generated by MySQL?

This is easy when you are familiar with how queries work

For example the easiest way to program is like this
PHP:

This results as X queries where X is the amount of forum posts you have made.
This is really stupid if you only need the last 10 posts because it can produce 5000 queries.

Think and merge (JOIN) the 2 queries and LIMIT it to 10 results.
PHP:
$result = $db->sql_query("SELECT topic_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id, auth_view, auth_read FROM ".$prefix."_bbtopics AS t INNER JOIN ".$prefix."_bbforums AS f ON (t.forum_id = f.forum_id) ORDER BY topic_last_post_id DESC LIMIT 0,10");

INNER JOIN means: merge and output selection if the two tables match. So if the query in ON () fails, the record won't be shown and counted.
This way, only one query is used, and you see a boost in the page generation time


How do i get even faster page generation?

Check your home page, do you have 50 blocks?
Reduce the number and check the time, or maybe it's just one block causing the issue.
If you are retrieving data from another site via RSS/XML or other methods, your page generation will be only as fast as that site is available.
Also check any custom images what are the file sizes?
Can you optimize those more?
remember most people are still on dialup.


stopsoftwarepatents.eu petition banner
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 0.1191 seconds with 8 DB Queries in 0.0555 seconds
Memory Usage: 1.49 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy