Mysql work slow
#1

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
Reply
#2

What do you mean? We don't get you.
Reply
#3

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
Reply
#4

Show me where you fetch all the data.
Reply
#5

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.
Reply
#6

I use mysql r-41>

Quote:
Originally Posted by AlphaPac
View Post
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");
Reply
#7

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
Reply
#8

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
Reply
#9

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?
Reply
#10

You're creating the loops the wrong way. Why are you having two variables which do the same?

PHP Code:
for(new iSOME_VALUEi++)
{
    
fetch data
    assign data

I don't see the need of a different variable at all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)