MyBB Community Forums

Full Version: Big Thread Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Is that a dedicated server of yours or are you hosting it somewhere else?
I have hosting. It could've been the server's fault.

And if that was a probable cause, Tikitiki could have easily said that.
Hi,

As said - we personally can't confirm it and the procedure put in place by MyBB, as mentioned is simple.

- Insert record in to database with time(). Unix timestamp of the current second since 1970.
- Fetch all posts ordered by the above time stamp in ascending order.

Because of the "glitchy" behaviour, it could be several things client side in your users browser or possibly server side.

- Server time may have for some reason gone out of sync and then was automatically synced back to the correct time. This would cause posts to appear in a different order because the time stamp cannot be correctly calculated.

- Your visitors or your server has some sort of proxying service which for some reason is caching pages.

I need you to find two posts in that thread. One of which should be a post which is not in its correct place, and the second post should be the post which is in its correct place that should have come AFTER the incorrectly placed one.
By the way, while we're on it, let me inform you of few queries which take more than 0.3 seconds on a pretty free server (resource wise), with topics having 20k posts.

Here are few of the culprits:
    [12] => Array
        (
            [0] => 0.304277896881
            [1] => SELECT pid FROM mybb_posts WHERE tid='238' ORDER BY dateline ASC LIMIT 0, 1
        )

    [22] => Array
        (
            [0] => 0.329091072083
            [1] => 
		SELECT u.uid, u.username, p.username AS postusername, p.dateline
		FROM mybb_posts p
		LEFT JOIN mybb_users u ON (u.uid=p.uid)
		WHERE p.tid='238' AND p.visible='1'
		ORDER BY p.dateline DESC
		LIMIT 1
        )

    [23] => Array
        (
            [0] => 0.358592033386
            [1] => 
		SELECT u.uid, u.username, p.username AS postusername, p.dateline
		FROM mybb_posts p
		LEFT JOIN mybb_users u ON (u.uid=p.uid)
		WHERE p.tid='238'
		ORDER BY p.dateline ASC
		LIMIT 1
	
        )

The first 0.3s query can be easily fixed by removing the order by. It uses the index after you remove the order by and the result is like in 0.008s. There isn't really an ascending order needed since that's the default.
uhh, which file are these queries from?

Regards,
Chris
PHP_Paul, what is your problem with me? I simply stated I pretty much have no freaking clue why it's happening, yet you seem to take that the wrong way. I'm stumped as is everyone else! So, even if I have an attitude sometimes, a good staff member wouldn't be able to help you anyway! As Chris has stated, it's highly unlikely it's a problem with MyBB because we know the code, and you don't and all the possible causes are client side or server side. And I NEVER said I wouldn't help you.

PHP_Paul Wrote:Tikitiki, honestly, what are you on the support team?

Every thread I've made you've come in and told me that it's not MyBB's fault...that there is no problem...that it's all my doing.

Name 3 that actually aren't your fault.

PHP_Paul Wrote:You know that PM editor glitch you hassled me about? Yeah, that was a width problem that WAS in one of the templates, but MyBB did not display it as modified, as it would if I had manually changed it (like you suggested).

Which thread is this?

PHP_Paul Wrote:I do not report glitches because it's a fun thing to do. I'm not trying to make work for you.

I never said you did.

PHP_Paul Wrote:And even if it IS on my side, then a good staff member would want to help me work that out.

Tikitiki Wrote:There's absolutely no reason why this would be happening. It's not like MyBB waits to insert posts into the database until someone else posts.

Does that help me in any way? Is it positive? No, neither. You don't need to sound condescending when I've been using MyBB from the RCs. I also have a background with PHP and MySQL. Yes, I realize that MyBB does not sit and wait to insert posts. That is obvious. What's not obvious is why that would happen. And maybe if you put your head to figuring out that problem, it would save us a lot of time and make the support team look better.

Some of us have lifes, and btw, in case you forgot, this is free. I don't have 24/7 to 'put my head to figuring out the problem'. Your lucky enough you have this product for free.

PHP_Paul Wrote:Because I'm really sick of the way you treat loyal MyBB users.

I treat loyal MyBB users the same way I treat everyone. It's just how I am. If you have a problem with it you can bring it up with Chris Boulton.

P.S., I'm actually a Developer.
Asad_Niazi Wrote:By the way, while we're on it, let me inform you of few queries which take more than 0.3 seconds on a pretty free server (resource wise), with topics having 20k posts.

Here are few of the culprits:
    [12] => Array
        (
            [0] => 0.304277896881
            [1] => SELECT pid FROM mybb_posts WHERE tid='238' ORDER BY dateline ASC LIMIT 0, 1
        )

    [22] => Array
        (
            [0] => 0.329091072083
            [1] => 
		SELECT u.uid, u.username, p.username AS postusername, p.dateline
		FROM mybb_posts p
		LEFT JOIN mybb_users u ON (u.uid=p.uid)
		WHERE p.tid='238' AND p.visible='1'
		ORDER BY p.dateline DESC
		LIMIT 1
        )

    [23] => Array
        (
            [0] => 0.358592033386
            [1] => 
		SELECT u.uid, u.username, p.username AS postusername, p.dateline
		FROM mybb_posts p
		LEFT JOIN mybb_users u ON (u.uid=p.uid)
		WHERE p.tid='238'
		ORDER BY p.dateline ASC
		LIMIT 1
	
        )

The first 0.3s query can be easily fixed by removing the order by. It uses the index after you remove the order by and the result is like in 0.008s. There isn't really an ascending order needed since that's the default.

I have a question, for queries that select multiple rows aren't order by's sort of required because the default setting can't be trusted? I believe labrocca or you said this in the Merge System forum? I'm just a little confused because I thought ASC is always default?
Chris Boulton Wrote:uhh, which file are these queries from?

Regards,
Chris

Sorry I didn't spend time to figure that out, but I modified the db_mysqli.php to record the timing and query string in an array. Later, just print all of that array in newreply.php, just below $plugins->run_hooks("newreply_do_newreply_end"); with a print_r and die.

Tikitiki Wrote:I have a question, for queries that select multiple rows aren't order by's sort of required because the default setting can't be trusted? I believe labrocca or you said this in the Merge System forum? I'm just a little confused because I thought ASC is always default?
You're right. When there are complicated joins, it's tough to trust the default ordering. However, you can trust it when it's a "SIMPLE" select, which in this case, is the first query. That's what I was referring to in my previous post Smile .. For the next two queries, sometimes it's better to use two queries if one cannot make use of the indexes. Because it needs more data than what is available on the indexes, the disk seeks are inevitable. It's better to do two queries here. First fetch the pid using a simple select, and then get rest of the data making use of that pid.

SELECT pid FROM mybb_posts p WHERE p.tid='238' LIMIT 1

You may even use order by if you really don't trust the default sorting, although I trust it for simple selects. Though you will have to use order by pid instead of dateline, which again, is the default sorting done by mysql. Maybe on a merged board, things might be different and in that case order by might be needed if things weren't really sorted right in first place. But in a default install, it can be avoided. Or some tweaks can be offered exclusively for bigger boards turning off sorting if there's no effect on functionality.

and FYI and these all queries were executed when logged in as admin and when replying to a topic. There were many queries, which ofcourse you can reproduce. For sake of convenience, the changes in db_mysql.php are as follows:

Find:
$querytime += $qtimer->totaltime;

Add below:
$this->time_data[] = array($qtimer->totaltime, $string);

Find in newreply.php:
$plugins->run_hooks("newreply_do_newreply_end");

Add below:
print_r($db->time_data);
die;
Question; Who would change the default from ASC to DESC?
Even though I'm a newbie, I'm afraid I'd like to make a point here - not sure why people want to apportion 'blame' and 'fault' so quickly?

So long as people post politely without first attributing blame to MyBB, but as a general query, then it would also be polite for staff to respond in a similar manner. However, I really believe most visitors shouldn't arrive and believe it's their right to receive a response from the staff, and sometimes comments may help others even if it doesn't seem that helpful to the original poster.

For instance, a newbie like myself didn't *know* that MyBB doesn't wait to post until the next 2-3 posts come along. It's not something that I've ever thought about, but hey, now I've learnt something new today along with the procedure that MyBB takes when posting, and how the server configuration could affect the post display (esp for large boards), so thanks to php_Paul for bringing up this scenario in the first place, and the staff for providing the comments and explanations.

Still, finger pointing is annoying and too easily done, and apologies for barging in on this thread.
Pages: 1 2 3