| 
	
 | 
 Posted by Jerry Stuckle on 12/06/06 03:41 
Vincent Delporte wrote: 
> Hi 
>  
> 	A friend is running a community application in PHP on a shared 
> server, and his provider is complaining that it's using the DB too 
> much. 
>  
> Apart from making changes to how data are organized in the DBMS, are 
> there ways in PHP to minimize DB load, eg. caching data instead of 
> reading/writing them from/to the DBMS every time, etc.? 
>  
> Thank you. 
 
Hi, Vincent, 
 
This is really a wide-open question.  There are so many things which can  
be done - all with their own advantages and disadvantages.  And they all  
depend on how the database is organized, the data are being requested,  
and a bunch more. 
 
For instance, you can save data used across multiple pages in the  
session - but that's only valid if the data have not changed, and the  
next page needs exactly the same data as the current one. 
 
Additionally, there may be ways of optimizing the database itself,  
creating a lighter load. 
 
Some suggestions - 
 
  Don't use persistent connections 
  Open the connection to the database once per page 
  Ensure your database queries are optimized (see the appropriate  
database newsgroup) 
  Make as few requests as you need to to get the data 
 
Just for starters. 
 
--  
================== 
Remove the "x" from my email address 
Jerry Stuckle 
JDS Computer Training Corp. 
jstucklex@attglobal.net 
==================
 
  
Navigation:
[Reply to this message] 
 |