MySQL, tables or columns
#1

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)