Tricks to speed up your querys.
Posted: Wed Nov 29, 2006 11:02 am
Im not an expert about it but i can say somethings and you too that will be so useful to others 
Well, i searched but didnt find anything about that
Start!
Well, hope it be useful to many people and please, sorry if my english is poor. Dont forget tell us your recomendations to speed up our script. The idea would be to do a list here with all tricks
Thank all.
Well, i searched but didnt find anything about that
Start!
- Select fields: there i read that take more time to find how many field your table has than take field that you write, and its obvius.
- (slow): mysql_query("SELECT * FROM table",$link);
- (quick): mysql_query("SELECT field1, field2, field3 FROM table",$link);
- Count how many rows has your table (suposed that you need just rows´s ammount):
- (so slow) take more memory than really need:
$sql=mysql_query("SELECT * FROM table",$link);
$sql_link=mysql_fetch_assoc($sql);
$cant=mysql_num_rows($sql_link); - (quick): $sql=mysql_query("SELECT count(*) as ammount_field FROM table",$link);
$sql_link=mysql_fetch_assoc($sql);
$cant=$sql_link['ammount_field'];
- (so slow) take more memory than really need:
Well, hope it be useful to many people and please, sorry if my english is poor. Dont forget tell us your recomendations to speed up our script. The idea would be to do a list here with all tricks
Thank all.