[HELP] Increasing MySQL efficiency.
#1

I have a shitton of houses on my RP MySQL-based server. This is how I load them when the server is starting up:

PHP код:
      mysql_query("SELECT `ID` FROM `houses`");
       
mysql_store_result();
       new 
id[128], housearray[MAX_HOUSES], bizzarray[MAX_BIZZES], ch=0cb=0;
     while(
mysql_fetch_row_format(id)) {
         
housearray[ch] = strval(id);
         
ch++;
     }
mysql_free_result(); 
Then:
PHP код:
for(new 0c<chc++) LoadHouse(housearray[c]); 
LoadHouse function is basically querying
PHP код:
SELECT FROM `housesWHERE `ID` = '%d' 
For every house.
And then I use
PHP код:
mysql_fetch_field_row(temp"ID"), hInfo[house_num][ID] = strval(temp); 
for every data related to the house storing it in the memory.

Is there anyway to make much less queries so I can load the server MUCH faster? I'm not a MySQL expert so I have no idea how to.
Reply
#2

Instead of selecting all house IDs and then sending numerous queries for every single house, you should just send one query that receives all house information at once.

pawn Код:
mysql_query("SELECT * FROM `houses`");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)