1
所以我有以下表鎮資源在我存儲每個城鎮ID的每個資源值。對於大量用戶的性能影響,我有點保留。我正在考慮將資源的餘額轉移到城鎮表中,並將資源的一般價值存儲在.php文件中:)。遊戲資源存儲
在這裏,你有townreources表:
CREATE TABLE IF NOT EXISTS `townresources` (
`townResourcesId` int(10) NOT NULL AUTO_INCREMENT,
`userId` int(10) NOT NULL,
`resourceId` int(10) NOT NULL,
`townId` int(10) NOT NULL,
`balance` decimal(8,2) NOT NULL,
`resourceRate` decimal(6,2) NOT NULL,
`lastUpdate` datetime NOT NULL,
PRIMARY KEY (`resourceId`,`townId`,`townResourcesId`,`userId`),
KEY `townResources_userId_users_userId` (`userId`),
KEY `townResources_townId_towns_townId` (`townId`),
KEY `townResourcesId` (`townResourcesId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Stores Town Resources' AUTO_INCREMENT=9 ;
至極是在我的情況下,最好的選擇:)
我稍後再試:-) – Bogdan