Why SELECT query slow (runs 0.5 sec)?

Hello!

In wordpress there is a standard plate wp_commentmeta so, there I only have 70K records and if I open it in phpmyadmin it opens quickly:

Showing rows 0 - 29 (77283 total, Query took 0.0001 sec)

But if I write a new review and this open sign it will be:

Showing rows 0 - 29 (77284 total, Query took 0.4455 seconds.)

And if I open it again the query takes 0.0001 sec.

ie, after adding a new record to this table it first opens for a very long time. This is not a problem, for example, with the table wp_postmeta where the 300K records

What could be the problem? To optimize, you can recreate the table tried - does not help.
June 10th 19 at 15:43
2 answers
June 10th 19 at 15:45
In General, the behavior is similar to an ordinary cache. The data is updated, the cache invaliditeta and cold, the query takes 0.5 s. After execution the result is cached, so subsequent execution of the query occurs "instantaneously". Roughly speaking, 0.5 is real execution time of this query. That's just why you have such a wp_postmeta with - that's interesting.
So I do not understand. Actually I have another issue - it's a long job wp_list_comments() - it 50 comments of a post displays for 3-4 seconds (the first time) why so long - I can not understand, even tried the tree to turn off the comments, all good there. Server capacity is excessive, PHP 7.1, the site has more complex tasks which is no problem. So I drew attention to this table, can it what is wrong with me anymore I'll never know what could be. But wp_list_comments() I have a separate question will ask himself all possible options to check. - guido_Funk commented on June 10th 19 at 15:48
And Yes, I wonder it seems suspicious that a simple SELECT * with a LIMIT of 30 on the "cold" runs in 0.5 seconds? - guido_Funk commented on June 10th 19 at 15:51
,
she's 50 comments of a post displays for 3-4 seconds (first time),

3-4 seconds is that? This is a total DB queries? This is a total of the entire backend? This is the complete download of the page at the front?

And Yes, I wonder it seems suspicious that a simple SELECT * with a LIMIT of 30 on the "cold" runs in 0.5 seconds?

No, not in vain. This is a very long time. - Velva.Rogahn commented on June 10th 19 at 15:54
June 10th 19 at 15:47
indexes are correctly placed?
Well, as properly as wordpress bequeathed and placed, I have not changed - guido_Funk commented on June 10th 19 at 15:50

Find more questions by tags WordPressMySQL