Keyword

Too many queries to Database

  • eugen
  • eugen's Avatar Topic Author
  • Offline
  • Junior Member
More
3 years 7 months ago #178719 by eugen
Too many queries to Database was created by eugen
Hello. Today I faced with big problem. From time to time my server crashes. I contacted the host and I was told that this request sometimes puts a lot of strain on the server

| 252 | ********310 | localhost | ********310 | Query | 37 | Sending data | SELECT SQL_CALC_FOUND_ROWS i.*, c.name AS categoryname, c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams FROM mk23m_k2_items AS i RIGHT JOIN mk23m_k2_categories AS c ON c.id = i.catid WHERE i.published = 1 AND i.access IN(1,2,5) AND i.trash = 0 AND c.published = 1 AND c.access IN(1,2,5) AND c.trash = 0 AND (i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2021-04-18 14:06:41') AND (i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2021-04-18 14:06:41') AND c.id IN(2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87) ORDER BY i.publish_up DESC LIMIT 30360, 8 | 0.000 |

Can you help me to understand  what happened and how does it fix. Thank you!

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #178722 by JoomlaWorks
Replied by JoomlaWorks on topic Too many queries to Database
Look, the issue is simple here:
- The query you see is the result of bot crawling on your site. Could be Google or some SEO bot.
- The database on the server is most likely not optimized. If you have root access to the server, you can do something about it (but you need to tell me first). If not, consider changing webhost.

K2 SQL queries are optimized as much as humanly possible. Your webhost can run an EXPLAIN on the query to see what I mean.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • eugen
  • eugen's Avatar Topic Author
  • Offline
  • Junior Member
More
3 years 7 months ago #178723 by eugen
Replied by eugen on topic Too many queries to Database
Hello Fotis. I have ROOT access. What should I do?

Please Log in or Create an account to join the conversation.

  • eugen
  • eugen's Avatar Topic Author
  • Offline
  • Junior Member
More
3 years 7 months ago #178737 by eugen
Replied by eugen on topic Too many queries to Database
Hello Fotis. What should I do?

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #178762 by JoomlaWorks
Replied by JoomlaWorks on topic Too many queries to Database
A few ideas...
a) block bots you're not interested in having your site crawled, e.g. SEO bots from Ahrefs etc. You can do that on "server" level, e.g. via .htaccess rules for Apache.
b) optimize your MySQL/MariaDB database. Here's a starting point:
Optimized my.cnf configuration for MySQL/MariaSQL (on cPanel/WHM servers): gist.github.com/fevangelou/0da9941e67a9c9bb2596
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers): gist.github.com/fevangelou/fb72f36bbe333e059b66

But you need to be comfortable with working on the terminal. If your server is managed, forward the links above to whoever manages your server updates etc.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum