R-a-dio / valkyrie

R/a/dio software stack
https://r-a-d.io
MIT License
5 stars 3 forks source link

storage/mariadb: use a different method of storing request user information #53

Closed Wessie closed 8 months ago

Wessie commented 5 years ago

We currently store a single entry for each IP/Host in the requesttime table in the database, instead we could store multiple entries in a new requests table, that also tracks what song was requested.

This should give us more data about what songs our users want and how often people request

Wessie commented 5 years ago

As found out earlier, the ip column currently does not have a UNIQUE constraint on it, so we can actually implement this without a schema change. The only potential problem would be the site code assuming the same thing we did before, that only one row exists of any singular ip

Wessie commented 5 years ago

https://github.com/R-a-dio/site/blob/4d90156ce7834d882fe0b9664b262474402e5139/app/start/global.php#L239

Wessie commented 5 years ago

The current schema also does not contain an index on the time column, so selects with an order by use a filesort over the full contents of the table