SA-MP Forums Archive
MySQL, tables or columns - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL, tables or columns (/showthread.php?tid=388102)



MySQL, tables or columns - Falcon. - 27.10.2012

hello,

I'm not sure how to structure the database, i'm making new systems for my server and the table have a big number of columns, (doing query slow).

what's better to do:
one table with various columns or more tables with less columns ?


Re: MySQL, tables or columns - Vince - 27.10.2012

Depends on what you want to do. But you would want to avoid having data doubled anywhere (except for the keys, of course).


Re: MySQL, tables or columns - Falcon. - 27.10.2012

currently i have 70 columns in table "accounts" with:
'connected', 'money', 'level', 'bank-money'... and I have to add even more, probably 50

when the player do login, i load all accounts table "select * from accounts where nickname=maria", 30 percent of columns are not used at this time.

the point is, sometimes I have to list all accounts "select x, y, z from contas where value=1"
probably the result is 170+ accounts


exemple:

select A,B,C,D,E,F,G,H from table Vince (with 100 columns)

or

select A,B,C,D from table Vince (with 50 columns)
select E,F,G,H from table Falcon (with 50 columns)


what i really wanna know is, which of the two gets more performance =/


Re: MySQL, tables or columns - SuperViper - 27.10.2012

Pretty sure keeping them in 1 table would be better. If not, it wouldn't make a difference.


Re: MySQL, tables or columns - Falcon. - 27.10.2012

I'm afraid of doing wrong, and then having to re-structure all database and pawn code =/


Re: MySQL, tables or columns - CoDeZ - 27.10.2012

Quote:
Originally Posted by [Y]Falcon
Посмотреть сообщение
currently i have 70 columns in table "accounts" with:
'connected', 'money', 'level', 'bank-money'... and I have to add even more, probably 50

when the player do login, i load all accounts table "select * from accounts where nickname=maria", 30 percent of columns are not used at this time.

the point is, sometimes I have to list all accounts "select x, y, z from contas where value=1"
probably the result is 170+ accounts


exemple:

select A,B,C,D,E,F,G,H from table Vince (with 100 columns)

or

select A,B,C,D from table Vince (with 50 columns)
select E,F,G,H from table Falcon (with 50 columns)


what i really wanna know is, which of the two gets more performance =/
Test everything out to know what will give you fast performance.