MyBB Community Forums

Full Version: Database Queries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
In most traditional forum software, including MyBB, database queries per page usually range from 10 -20. With databases we receive lots of information such as user posts, permissions, signatures, etc. My favorite CMS Drupal to display half the information forum software does routinely has database queries ranging in the 100's.

How is MyBB structured compared to a Drupal and other similar CMS's that it can pull vast amounts of information with only a fraction of the database queries?
More than likely because it's just the forum. Drupal has to make a query for every side box and what not.
Cache is your friend.
(2009-10-07, 03:23 AM)Ryan Ashbrook Wrote: [ -> ]Cache is your friend.

I created a dummy post with Drupal with 10 posts by 3 users. Without cache there are 136 db queries and after both caches (standard and block) it is reduced to 103 db queries.

Same post with MyBB, still 18 queries.

I'm curious if there is some secret sauce that makes MyBB's database structure more efficient.

(PS: I have made my decision to use MyBB over Drupal for my forum)
I would recommend asking over at drupal. But, I would still say it's due to everything being dynamic. I mean all the menus, blocks, other modules, and the content it self has to be pulled from the database.

While many of those things are part of the templates in mybb.
(2009-10-07, 04:39 AM)NetSage Wrote: [ -> ]While many of those things are part of the templates in mybb.

I always wondered how much that would speed things up if you eliminated all of the variables in a lot of packages. There there for ease of use, but from a performance stand point I wonder how many people go in there and hard code things in the template.
Well with mybb the templates are actually in the database Toungue.

But, with drupal basically nothing is hardcoded and if it is there is an if before it. Drupal is all about complete freedom in every sense of the word. To provide this they have to have everything be its own thing.
(2009-10-07, 05:46 AM)NetSage Wrote: [ -> ]Well with mybb the templates are actually in the database Toungue.

It took me a while to figure that out. I was searching through all the folders with Filezilla looking to right click a file and edit it. Currently I cut and paste the template out of Codepress and into Notepad++ to edit and then copy it back. Maybe in the future I will drink the koolaid and use Codepress.
It irritates me to no end when Codepress tries to be "helpful." No, I do not want that "closing" quote, this one was it. Stop putting newlines every time I paste! And quit screwing up my indentation style! This is why I turned it off.

I don't know how Drupal does things, but I know that when MyBB queries the DB, it grabs as much as will most likely be useful. Drupal might be more efficient if they do "SELECT * FROM sideStuff WHERE selectWillGetAllSideThingsInOneGo;" but like I said I don't know how they do things.
(2009-10-07, 05:46 AM)NetSage Wrote: [ -> ]Well with mybb the templates are actually in the database Toungue.

All the templates are retrieved by using one massive SQL query, and then stored in a cache. That way, you don't have to have 45 different SQL queries just to load templates.

Firestryke is right though, MyBB uses left joins, array cache-thingies and what-not to save SQL queries. Or, simply, it's just too damn good...

Shy
Pages: 1 2