PartitionKey is PlayerId-TroopId, so an entity is created for each troop that a player has. This means that on average, for a TH12-TH15 player, ~20 entities are created
Each entity does not only contain the troop data, but also the player's basic details such as townhall level, attack wins, player clan, etc. This information is redundant if it appears in all entities of the same player.
Currently, we see the following issues:
Player table is currently growing too fast, and each row/entity contains too much redundant information.
Unable to quickly check to see if a player's data exists in the table. It currently requires us to query entities from the table, which has high time complexity compared to getting the entity itself directly from the table.
Solution:
Split Player table into Player and PlayerTroops tables. The new Player table should only contain the Player information, i.e. 1 row/entity per player. The PlayerTroops table will contain all the player's troops data, so each player will have ~20 entities created for every scrape. The PlayerTroops table will only contain the player's ID, troop IDs and troop levels, taking up less storage.
Current design of Player table:
Currently, we see the following issues:
Solution: Split Player table into Player and PlayerTroops tables. The new Player table should only contain the Player information, i.e. 1 row/entity per player. The PlayerTroops table will contain all the player's troops data, so each player will have ~20 entities created for every scrape. The PlayerTroops table will only contain the player's ID, troop IDs and troop levels, taking up less storage.