MyBB Community Forums

Full Version: Templates System (SQL Load)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well, I like very much than I can change the templates from Admin Panel, but I have a question, the fact of save in a field of "templates table" in the Database, can cause an overload, because then each time than a user see a page, do a query in mysql, then this would cause several queries, oveloading mysql quickly

I only want know the following

Can the template system cause more load to mysql?

or mybb use some cache system?, (only doing one query in mysql each time when are changed the templates)
Somebody can say me anything?

Sorry by my bad english, if you do not understood me, please say me, and I will be more careful, writing

Regards
At the beginning of each page, a list of the main templates used on that page is generated and in one select query. All those templates are cached in the memory for the duration of the execution of that page. So it's not one query per template, but there could be a few.
I actually converted the template system to files and did some benchmarks. It's actually faster to do it from MySQL. I didn't look at memory load of CPU load, but page generation was faster with MySQL.
If you want to try it for yourself, you only need write a simple script that takes each template and writes it to a file.
Then a simple case of altering class_template.php to use file_get_contents() instead of the database.

The beauty of files is that it will cost the same in terms of CPU and time if a template is not in the template list at the start. If a template is missed using mysql, then it needs another query to get it.
But overall, it seems mysql is faster.
Well, really many thanks, seem to be mysql is faster, then I will use the Template System of MyBB but I have a doubt can myBB do the following??:

Only do queries in "Templates Table" of the DataBase when is changed the template by the Admin, saving more time in cache each file and reducing the numbers of queries in MySQL

Is possible or this do it actually?
Yes, its possible
Tikitiki Wrote:Yes, its possible

How Can do it?
It would be way too hard to tell it all to you... Maybe it will come in 2.0 heh