2. In your scripts
Limit the number of records displayed (eg 10 per page) with the LIMIT part of your SQL query.
Group your requests at the beginning of the script in this way:
open_connection
request1
request2
...
close_connection
Display...
Treat data
Loop through data...
Display...
...
- Optimise your database by using cache
If there are elements in your database which do not change, you should cache them.Following this tip will drastically diminish the need to access your database and speed up your site's load time.You can also perform session cache.Put query results into a session variable. This means that you do not need to run an identical query next time, you can just retrieve the session variables instead.Only recover the data which is usedIn your SQL requests, make sure you select only what you need, and that you have not forgotten the links between the tables.Example:
(where table1.champs = table2.champs2)
- Avoid resource intensive options:
Avoid using the "HAVING" clause which can slow down queries. You should also avoid using "GROUP BY", unless strictly necessary.