• Hi guys,

    For some time i have a problem with slow loading time of the front page of my site https://opserver.mk/ (post loading is ok). I checked everything that i could find on the internet, but could not find the source of the problem. I’ve installed everything from the beggining including a new theme, but after importing database tables post and post meta, the front page could not be loaded. I reduced the number of content to the last 150 days with a code and the site is working now but the front page is again slow.

    I used this code to reduce the number of posts:

    delete from wpqg_posts
    where datediff(now(), wpqg_posts.Post_Date) > 150;

    SELECT * FROM wpqg_postmeta pm LEFT JOIN wpqg_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;
    DELETE pm FROM wpqg_postmeta pm LEFT JOIN wpqg_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;

    When i test the page on https://gtmetrix.com/reports/opserver.mk/aiW87Qxl/ i noticed this:

    https://opserver.mk/wp-content/uploads/2023/02/problem.jpg

    How to find out what is causing that second request and why is so long?!

    Tried to turn on slow_query_log with this code, but i don’t have the privilages:

    mysql> SET GLOBAL slow_query_log = 1;

    Somehow everything is pointing to think that there is some query to the database that it need long time to finish….

    • This topic was modified 1 year, 9 months ago by birach.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator bcworkz

    (@bcworkz)

    Try using the Query Monitor plugin to help you identify which query is taking so long.

    FWIW, you also have a lot of CSS files to load. Consider using an optimization plugin to minify and consolidate all of them into fewer files. This is minor compared to the initial server response, but if you can resolve the response time this will then be a bigger issue.

    Thread Starter birach

    (@birach)

    I am using it. This is what i get:

    Why this happens?:

    It looks like second request to the site and that is what takes too long….

    Fot the CSS i will deal later. I have litespeed on server side and i have the plugin installed also, so i don’t know which plugin will not have a problem to be in parralel so i can minify. I have bought wp-optimize-pro but i did not turn on in parralel.

    Moderator bcworkz

    (@bcworkz)

    Look at the brown highlight in the admin bar. 494 queries and a gigabyte of data! That’s why the page is slow. 55 duplicate queries isn’t helping either.

    How big is the database overall? The bigger a table is, the longer queries are going to take. Extremely large databases will require further optimization beyond what WP does by default.

    Which component is responsible for most of the slow queries? Looks like it might be newzin_plugin. It appears to be attempting to cache a bunch of posts. I question how useful that would really be. The concept of caching is good, but if not done well it can be counterproductive. It can take more time to build the cache than time it saves. Seriously consider eliminating time consuming components.

    If your front page really requires over a gigabyte of DB data, it’s too large to start with. Content should be significantly reduced. Important information could be provided elsewhere and just linked to from the home page. Or at least lazy load below the fold content so the initial page load speed is lessened.

    Thread Starter birach

    (@birach)

    The database was 3,4GB, 250k posts, and i reduced it before i wrote here. The theme was working great before i imported the tables. It is an information web site and we have arround 200 new posts every day, and until few moths ago (we are active 5 y) i did not have such a problem. I think there is some data that is damaged and is redducing the time to open front page. I noticed the number of data withdrown from post table but i don’t know how to limit them?! If you see the front page, it doesn’t need so much posts. Did you see the marked line in the last picture? How to find out what is happening there?!

    Also, for test, i tried to reduce the number of posts to the last 30 days with the same codes that i used before, but then only header showed and i had 404 error. In any case, due to the type of work, i must have at least one year of posts, and that would again be a lot.

    Moderator bcworkz

    (@bcworkz)

    The 9.2 sec delay is a culmination of all the slow queries. There is not one specific cause.

    You can limit how many records are returned in SQL with the LIMIT clause. Have the records start after so many other records with OFFSET.

    Thread Starter birach

    (@birach)

    Tried the LIMIT clause…. It limited in the database, but it did not efect the web page

    Moderator bcworkz

    (@bcworkz)

    You might try a lazy load or infinite scroll plugin that defers requesting content that occurs below the fold. Many lazy loaders only work on images, you want something that works on all content.

    Thread Starter birach

    (@birach)

    hi, i could’t find any good plugin for that….

    Any suggestion?

    Moderator bcworkz

    (@bcworkz)

    There are a number of infinite scroll plugins. I’ve not used any of them, so I cannot say if any are “good” or not. It may be possible to customize the source code of one of them to address any shortcomings that one might have.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Slow frontpage, posible database problem’ is closed to new replies.