PHP ladies and gentlemen, there are ten queries in an interface. How can sql be optimized in terms of code?

the interface runs slowly

Oct.23,2021

minimize the number of sql


slow, you have to figure out where to slow first. What answer do you want if you write a few words like this?

if sql is slow, let's see if the database connection is normal. Is there anything wrong with your writing? Whether the index has been built or not, etc.


possible reasons:
1. Join table query
2. Query
3 in the loop Heavy use of subqueries

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b371b6-2c050.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b371b6-2c050.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?