eveseat / seat

🌀✳️ SeAT: A Simple, EVE Online API Tool and Corporation Manager
https://eveseat.github.io/docs/
GNU General Public License v2.0
433 stars 142 forks source link

Potential missing index for larger amounts of data in character_wallet_journals #873

Open kwazulueve opened 2 years ago

kwazulueve commented 2 years ago

In our table character_wallet_journals we have over 10 million rows, quite a few characters having 100 k+ rows, and some individuals having over 500 k entries. There is a query (example shown below) that causes significant load on the mysql database, possibly to update the value of the corresponding character entry in character_wallet_balances (but I do not know that certain)

MySQLWorkbench_2022-08-25_00-32-27.

I've manually added an extra index (KEY idx_character_wallet_journals_character_id_date (character_id,date)) that completely removes these heavy queries and brings down the server load.

warlof commented 2 years ago

hi @kwazulueve

I've been able to confirm this. I've not been able to find what is generating this exact query though. Wallet table are paginating result using limit 10 offset X where X is the current page * 10.

Without your index

image

With your index

image

Update will be shipped on next update.