Link to home
Start Free TrialLog in
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
Avatar of slightwv (䄆 Netminder)
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
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.