We help IT Professionals succeed at work.

Faster Quieries

33 Views
Last Modified: 2020-06-22
We have a LAMP Cloud App in PHP 7 using MySQL. We use nested queries and it takes a long time to get to the desired records.

Among the options we are looking at to speed up the queries are:

Change to another Database (Please advise which)
Optimize the code

I'll appreciate letting me know what to do to speed up the queries.

Thanks

Luis R
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:
Most performance issues are due to bad design and bad SQL.  Moving "bad" things to a different database won't help increase performance.

Now to the tuning of what you have:  There isn't a silver bullet to tuning systems.  People make their entire careers out of nothing but tuning.

I would first look at the execution plan to make sure it is accessing tables and indexes the way you think it should:
https://dev.mysql.com/doc/refman/8.0/en/explain.html

You mention nested queries.  Try to make sure you aren't accessing the same large tables over and over.  Try to get everything you need from them once.
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
nociSoftware Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
If you often do queries over and over (with mostly the same resulting content), storing the intermediate results in  a memcache may help there as well.

If you have differing requirements for parts of the code, nginx with several instances of php-fpm can help there as well,
if you can select on url that is, creating several backend php-fpm instances, is easy to access from nginx.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.