I want to try MySQL Partitioning in a football fantasy game where users are distributed in leagues, and each league has a market where users can sell or buy players. I'm experiencing some deadlocks in this table when a lot of users play at the same time (there are about 50K leagues at the time of writing, each one with about 20 players in the market refreshed every two days), so I was thinking about using MySQL Partitioning, which I haven't used before.
This is the table I would like to partition:
CREATE TABLE `market` (
`leagueID` int(10) unsigned NOT NULL,
`playerID` smallint(5) unsigned NOT NULL,
`userID` int(10) unsigned DEFAULT,
`price` int(10) unsigned NOT NULL ,
`date` int(10) unsigned NOT NULL,
UNIQUE KEY `league_player` (`leagueID`,`playerID`),
KEY `user_date` (`userID`,`date`)
);
Which approach (column, ranges, number of partitions, etc.) do you recommend?
This is my initial approach:
ALTER TABLE market
PARTITION BY HASH(leagueID)
PARTITIONS 10;