MySQL auto increment
#1

Hi guys,

My vehicle ownership engine saves automatically when the game mode is shut down, to save, it references the array index to figure out which mysql row to edit, the mysql table has a column called ID, this is auto incremented.

Everybody knows that, when you delete a row, auto increment will not account for this, I have made a fix, but it takes an extremely long time to execute the query/, which in turn completely desyncs my server for up to a minute!

Код:
ALTER TABLE `playervehicles` DROP COLUMN `id`
Код:
ALTER TABLE `playervehicles` ADD COLUMN `id` INT(11) PRIMARY KEY AUTO_INCREMENT NOT NULL
They are the queries I'm running, doing all this takes an extremely long time to execute, does anybody know a faster way to reset auto_increment or why this is taking so long? could it be related to the mysql database's host? (It's not home, it's a friends VPS, which is located in Dallas, and I'm in England.)

Thanks in advance.
Reply
#2

Are you calling the query on a home server, or a server hosted on the VPS?

You sorta confused me with the last sentence you said.
Reply
#3

I'm running it on a server hosted in england, but the mysql host is in Dallas.

Doesn't that sound stupid, we aint keeping this Dallas based VPS
Reply
#4

Why on earth are you doing that? I think using .ini is even faster than external databases..
Reply
#5

Remote database does indeed sound a little bad, but why would you want to reorder the auto increment values? While they greatly help you with unique IDs, you can have better ways of managing your list of vehicles so you don't have to reorder the table.

Lets say you have an enumeration for vehicle data. In there, include a value that represents the vehicle's ID in the database. This way, reorganizing anything isn't necessary.
Reply
#6

I didn't ask what is better, if I wanted to use files, I would.

MySQL is simply the best all round in my opinion, can be displayed on a website, faster than SQLite and it has awesome functionality. Why not?

Quote:

Lets say you have an enumeration for vehicle data. In there, include a value that represents the vehicle's ID in the database. This way, reorganizing anything isn't necessary.

It saves under OnGameModeInit, how would I figure out which mysql row to edit based upon a vehicleid or array index? (That's actually given me an idea, could I use SELECT?)

EDIT:

When the server runs on the VPS, will it still be this slow, or is it just a distance issue? ( I cannot test right now )
Reply
#7

Sorry double post. Thought you could delete posts.
Reply
#8

Quote:
Originally Posted by GamingTurf
Посмотреть сообщение
Why on earth are you doing that? I think using .ini is even faster than external databases..
The INI file format is a standard for configuration files, not for handling large number of accounts. They are also deprecated because of their less functionality and performance. MySQL is the best for managing large number of accounts with great performance. Remote connection will always be slow than local connection. But that doesn't means MySQL is slower.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)