Doubt regarding database performance
#6

Quote:
Originally Posted by SupremeCommander
Посмотреть сообщение
You guys misunderstood me. My question was not about having as many columns, but about giving every column(integer and float) a default value of 0. Would it affect performance? Should you do it for PAWN? and if there is performance difference, is it negligible?

But anyways thanks a lot for all replies!
As ****** already said, sites with billions of users use MySQL and have no performance issues.
A small SAMP server (even if your run a server with 1000 players) won't even make a small dent in MySQL.

Having 100 fields with a default value of 0, which are automatically set when you create a new account for example, is about the same as having no default value and sending a huge query to set them all to 0.
I'd say this huge query makes more impact because you're sending a long string of text to MySQL to interpret.
Interpreting a string takes alot longer than a small string.

Sending a small query to MySQL and let it set all default values to 0 automatically would be better.
Less overhead of communications between 2 programs, less text to interpret by MySQL would result in better performance.

After all, PAWN doesn't handle NULL values properly as I read somewhere.
Setting default values automatically gets rid of that problem.

Imagine you create a new account (when a new player logs in) and you send a huge query to MySQL, setting everything to 0 because you didn't set default values (for money, score, adminleven, jobs done, ...) in the tables of MySQL.
And you edit the script afterwards to include a new field.
You would have to edit that huge query again, perhaps splitting it up even further, to prevent errors about "line too long".
You could make mistakes during the rewrite of your query.

Having default values gets rid of that.
You still create the new account the same way you did before (insert a new account with only the playername and password).
The new field automatically gets set to 0 by MySQL itself.
No need to edit that huge query, with possible mistakes.

All you need to do is create a new, small function to update that new field whenever the data on your server changes and you're done.

For myself, I'm setting all data-fields to default value 0, besides ID, playername and password because those NEED to be inserted for a new account.
Even if you want a new player to get some default money, you could add it to the query easily and MySQL won't use that default value because it's overridden by your query.
Reply


Messages In This Thread
Doubt regarding database performance - by SupremeCommander - 21.12.2014, 18:43
Re: Doubt regarding database performance - by Vince - 21.12.2014, 19:21
Re: Doubt regarding database performance - by SupremeCommander - 21.12.2014, 19:53
Re: Doubt regarding database performance - by PowerPC603 - 21.12.2014, 21:00
Re: Doubt regarding database performance - by SupremeCommander - 22.12.2014, 08:10
Re: Doubt regarding database performance - by PowerPC603 - 22.12.2014, 21:19

Forum Jump:


Users browsing this thread: 1 Guest(s)