MySQL Forums :: Newbie :: Transaction/Locking Question


Advanced Search

Transaction/Locking Question
Posted by: Rob Johansen ()
Date: May 25, 2012 08:11AM

Hi,

I'm trying to decide between MyISAM and InnoDB for one of my tables. This table will store information for two-player games, where each record represents a single instance of the game. I expect the table to be read frequently (when players launch the game) and updated frequently (as players periodically save their game state). Inserts and deletes will only occur when a game is started or finished, respectively (i.e. less frequent than selects/updates).

Naturally I want to preserve integrity without sacrificing performance. However, since it's a two-player game, obviously both players could be attempting to update a game record at the same time.

These may be dumb questions, but I'm going to ask them anyway:

1. Does it sound like I need InnoDB and transactions, or could I somehow accomplish what I want with MyISAM?

2. Could this be a good case for GET_LOCK(), where the two players of a game agree on a lock name unique to their game?

3. Would it help if I design my table (and my application) such that players never update the same columns in a given record? For example, player 1 could store her game state in the "player1_game_state" column, while player 2 stores his game state in the "player2_game_state" column. Perhaps then the players could concurrently store their game states without stepping on each other's toes (and the application would be responsible for combining both game states).

4. Do you have any suggestions, recommendations, or ideas that I'm not thinking of?

Thanks,
Rob

Options: ReplyQuote


Subject Written By Posted
Transaction/Locking Question Rob Johansen 05/25/2012 08:11AM
Re: Transaction/Locking Question Rob Johansen 05/25/2012 11:45AM
Re: Transaction/Locking Question Peter Brawley 05/25/2012 12:24PM
Re: Transaction/Locking Question Rick James 05/27/2012 09:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.