Keyword

Too many queries to Database

More
3 weeks 1 day 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
3 weeks 22 hours ago #178722 by Fotis
Replied by Fotis 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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

More
3 weeks 12 hours 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.

More
2 weeks 6 days 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.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 3 days ago #178762 by Fotis
Replied by Fotis 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.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum