Making Dragonfly Faster ⇒ Frequently Asked Questions ⇒ CPG Dragonfly™ CMS

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
// Run a single query $result = $db->query("SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM {$db->TBL->bbtopics} ORDER BY topic_last_post_id DESC"); // Run a while loop to process each found record. while (list($topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id) = $result->fetch_row()) { // Run a query in the loop $result1 = $db->query("SELECT auth_view, auth_read FROM {$db->TBL->bbforums} WHERE forum_id = '$forum_id'"); list($auth_view, $auth_read) = $result->fetch_row(); }

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.
$result = $db->query("SELECT topic_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id, auth_view, auth_read FROM {$db->TBL->bbtopics} AS t INNER JOIN {$db->TBL->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.
User Info

Welcome Anonymous



(Register)
Community

Support for DragonflyCMS in a other languages:

Deutsch
Español