Mysql work slow -
Mister0 - 21.09.2017
So why mysql load tables very slow on windows 10?
When I open the console it say mysql database conected instantly but the mysql_pquery who load the tables from data base it load after some seconds and load one by one each on an interval of 2-7 seconds random.
What can I do I try many methods optimized the apache change the mysql version re write the query but still very slow
Re: Mysql work slow -
Logic_ - 21.09.2017
What do you mean? We don't get you.
Re: Mysql work slow -
Mister0 - 21.09.2017
I can open any samp server but if the server is connected to the mysql database then my tables load very slow
like this
mysql_pquery(handle, "SELECT * FROM `business`", "LoadBusiness");
mysql_pquery(handle, "SELECT * FROM `jobsname` ORDER BY `ID` ASC", "LoadJobs");
my gamemode is loaded with vehicles model and all what he need but after some seconds or minutes it show the tables are loaded
Re: Mysql work slow -
AlphaPac - 22.09.2017
Show me where you fetch all the data.
Re: Mysql work slow -
raydx - 22.09.2017
Because these queries are threaded. Use mysql_query instead of mysql_pquery for server loading queries.
Off course you can't do it without rewriting a lot of loading code.
Re: Mysql work slow -
Mister0 - 22.09.2017
I use mysql r-41>
Quote:
Originally Posted by AlphaPac
Show me where you fetch all the data.
|
You mean the publics
Code:
pc LoadBusiness()
{
Toatal_Business_Created = cache_num_rows();
new i,x;
for(i=0;i<Toatal_Business_Created;i++)
{
x++;
//LOADING=========================================================================/
cache_get_value(i, "ID", temp); BusinessInfo[x][bID] = strval(temp);
cache_get_value(i, "Owner", temp); format(BusinessInfo[x][bOwner],52,temp);
cache_get_value(i, "ExtX", temp); BusinessInfo[x][bExtX] = floatstr(temp);
cache_get_value(i, "ExtY", temp); BusinessInfo[x][bExtY] = floatstr(temp);
cache_get_value(i, "ExtZ", temp); BusinessInfo[x][bExtZ] = floatstr(temp);
}
printf("[GAMEMODE]: Business Loaded %i bizz's. %dQ", Toatal_Business_Created,NumQuery),NumQuery++;
return 1;
}
Because these queries are threaded. Use mysql_query instead of mysql_pquery for server loading queries.
Off course you can't do it without rewriting a lot of loading code.
And how you want to use mysql_query on this?
mysql_pquery(handle, "SELECT * FROM `business`", "LoadBusiness");
Re: Mysql work slow -
Banditul18 - 22.09.2017
Well ,in first place why don't u use native function from mysql? With format, strval and floatstr of course its a little bit hard to process
PHP Code:
public LoadBusiness()
{
Toatal_Business_Created = cache_num_rows();
new i,x;
for(i=0;i<Toatal_Business_Created;i++)
{
x++;
//LOADING=========================================================================/
cache_get_value_name_int(i, "ID", BusinessInfo[x][bID]);
cache_get_value_name(i, "Owner", BusinessInfo[x][bOwner], MAX_PLAYER_NAME);
cache_get_value_name_float(i, "ExtX", BusinessInfo[x][bExtX]);
cache_get_value_name_float(i, "ExtY", BusinessInfo[x][bExtY]);
cache_get_value_name_float(i, "ExtZ", BusinessInfo[x][bExtZ]);
}
printf("[GAMEMODE]: Business Loaded %i bizz's. %dQ", Toatal_Business_Created,NumQuery),NumQuery++;
return 1;
}
And to be honest, use mysql_tquery. I know its not paralel query, but will work 100/100
Re: Mysql work slow -
Mister0 - 22.09.2017
Ok let's say I modified every line but why onwindows 7 I didn t have this problem?
I edited and replaced and still same
Re: Mysql work slow -
Mister0 - 22.09.2017
The problem is if I delete every
for(i=0;i<Toatal_Business_Created;i++)
{
cache_delete etc
}
the table load ok slow but at least they are loading every in the same minute, but How else could I load every line from tables?
Re: Mysql work slow -
Logic_ - 22.09.2017
You're creating the loops the wrong way. Why are you having two variables which do the same?
PHP Code:
for(new i; i < SOME_VALUE; i++)
{
fetch data
assign data
}
I don't see the need of a different variable at all.