0

After we have run our codes and is functioning the way we want, something else faces us in the future and thats speed and scalability. Example a blog site must query the database to pull blog contents from the wp blog table, like wise our oroducts post and pages itself, and if we run user dashboard we still query if user is logged in and previledges.
Most times this type of query are executed on every page load. Is there a way to handle this and serve cached content without having to query the data base all times on page load and how reliable can cached content be? Or was mysql built as a query king to absorb any kind of query every secs without feeling headache, please what is the best approach seeing the life of our website depends on our database but yet no function gets done without querying the database.

3
  • You can also sign up for ElasticPress.io and hook their functionality directly into some of your queries. What this would do is alleviate some of the burden on your server and db - you could set it so that posts, pages and products use ElasticPress in their queries but keep orders and the admin dashboard using standard WP queries. I tested this on a page that was running 17 queries based on taxonomies, and adding EP reduced the query count to 5 with zero impact on load times. Only problem is that it can get pricey. – Tony Djukic Jun 5 '20 at 15:47
  • Really sounds interesting but how secured can this be and is it not a bridge of privacy sending users data to a third party, i love something i can control on my own so i can take the blame when things happen – pandglobal Jun 5 '20 at 16:32
  • Well you have the ability to control which post_types are indexed vs. which aren't. The pages, posts and products are public anyway. You can set the orders to not be indexed as you're not using EP with them anyway. Additionally, you can download ElasticSearch and install it on your own servers, but then you have manage and maintain it all yourself and from past experience you need a good devops and systems admin team for that. – Tony Djukic Jun 5 '20 at 20:33
0

You can use a combination of caching plugin and appropriately coded themes and plugins to cache query results and speed things up. Yes, eventually if you are running many queries, a site can get bogged down. This typically happens when query-intensive themes or plugins are used.

To start investigating your own site's queries, there are query monitoring plugins available - try installing one and you will see what queries are running where. From there, you can determine whether plugins or the theme are running the most intensive queries, and either try out alternative themes/plugins or code a child theme to reduce the load. You may also find that using (and properly configuring) a caching plugin may relieve much of the burden. It varies site to site, depending on the underlying server architecture, where visitors are coming from, how many visits you're getting, and what exactly your site is trying to do.

1
  • Great @webElaine am not using any using any third party plugin on my site, i did all the code myself so i know which queries are running and their purpose, everything works fine but am think about when users increases what will be the fate of my database – pandglobal Jun 5 '20 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.