Avatar of Luis Rodriguez-Galvan
Luis Rodriguez-GalvanFlag for Mexico asked on

Faster Quieries

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
RDatabasesPHPStatistical Packages

Avatar of undefined
Last Comment
noci

8/22/2022 - Mon
slightwv (䄆 Netminder)

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.
ASKER CERTIFIED SOLUTION
Chris Stanyon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
noci

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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck