[MYSQL] proper way to do multi-table query??Rep+
#1

Hello guys, I confused this.
I use lots of table to store player's data but on player login, I have to load them all.

now I use this-kind method to loadit, but its slowly.
Can you point a proper way to do this
Код:
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `a` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `b` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `c` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `d` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `e` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `f` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);
	mysql_format(mySQL, query, sizeof query,
		"SELECT * FROM `g` WHERE `id` = '%d';", pid);
	);
	mysql_tquery(mysql, query, "", "d", playerid);




THX.
Reply
#2

What do these tables store, that is a lot of tables for simple player data..
Reply
#3

Yea, more than 60 fileds in one table, and I split its up to lots tables.
I just thought a method, but I think its still slowly.

make every tquery the same callback, and give it a check.

when check = 1, load mysql_format(1);
end, check ++
and then. check = 2, =3 , =4.
when check = end. call a func.

so....slowly I think.
Reply
#4

As long as it's threaded it shouldn't matter. However your example is too abstract. Some tables may be able to be joined together while others may be left out completely. Storing non-essential data in variables seems redundant to me.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
As long as it's threaded it shouldn't matter. However your example is too abstract. Some tables may be able to be joined together while others may be left out completely. Storing non-essential data in variables seems redundant to me.
no no no,
some states data will be stored in one table. and it need update per sceond.
and some non-changed data like name, password and salt in one table.
weapons in one tables changed by call.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)