zengfung / ClashOfClansScraper

1 stars 0 forks source link

Separate Player table to Player and PlayerTroops table #25

Closed zengfung closed 1 year ago

zengfung commented 1 year ago

Current design of Player table:

Currently, we see the following issues:

  1. Player table is currently growing too fast, and each row/entity contains too much redundant information.
  2. 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.