News:

Wondering if this will always be free?  See why free is better.

Main Menu

SMF 2.1.3 and crazy CPU load

Started by Daretary, March 24, 2023, 01:23:43 PM

Previous topic - Next topic

Arantor

That's not core SMF code - there's nowhere that IDs are hard coded in core (at least, not like that!) and most sites don't have that many categories.

It was sort of why I'd asked earlier about what the processlist was reporting because I suspected a custom query.

Daretary

Quote from: shawnb61 on March 25, 2023, 04:22:11 AMPlease answer the questions.
This is a homemade code that displays the latest topics in the selected categories. What else have I not answered? :)

Aleksi "Lex" Kilpinen

Quote from: Daretary on March 25, 2023, 05:33:34 AM
Quote from: shawnb61 on March 25, 2023, 04:22:11 AMPlease answer the questions.
This is a homemade code that displays the latest topics in the selected categories. What else have I not answered? :)
Well, you blamed SMF but if it's your own code, then how is SMF at fault?
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Daretary

Dear Aleksi "Lex" Kilpinen.
I've already apologized twice in this thread.

Forgive me again!

And don't think I offended SMF. On the contrary, I exalted SMF 1.1.21. I will remember her with nostalgia. :'(

DeadMan...

Quote from: Daretary on March 25, 2023, 06:42:41 AMAnd don't think I offended SMF.
On the contrary, you did:

Quote from: Daretary on March 24, 2023, 01:23:43 PMI really regretted that I spent a lot of time on the transition to SMF 2.1.3.
I tell it how I see it... Don't like it? Hit Alt+F4!

Daretary


DeadMan...

You just need to remember, that sometimes, you have to calm down and seek assistance instead of judging something due to issues. One never knows when something that works on one version may be an issue on another. The different ways of coding and database calls can cause issues with edits and mods. That's why it's very important to post about things, as not only can it help you, but it may help others.

I commend you on the posting the issue in the first place. It helped you, and also taught you a valuable lesson: Never judge something due to a problem until you make sure of what the issue is.
I tell it how I see it... Don't like it? Hit Alt+F4!

shawnb61

Glad you got it sorted out!
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

live627

Quote from: Daretary on March 25, 2023, 01:25:34 AMI apologize again, the problem turned out to be in this query:

    $request = $smcFunc['db_query']('', '
SELECT m.subject, m.id_topic, m.icon
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE b.id_cat IN (7,18,21,23,25,5,24,14,15)
ORDER BY id_topic DESC
LIMIT 15'
    );


All three of those tables store the board id so you could simplify that query by replacing category ids with board ids and dropping the join on boards.

Daretary

live627, I don't quite understand. Should I list all board IDs?

live627

Your predicate would include all board ids that have those categories assigned to them

t.id_board IN (list_of_ids)

Daretary

Every day I go to this topic, I read what live627 wrote. I hoped that it would enlighten me.
But to no avail. :'(

Steve

Marking unsolved then as you still seem to have an issue that needs resolved.
DO NOT pm me for support!

Advertisement: