I have a table of around 30 million retail products, with various INT columns that describe sales counters and pricing at different retailers.
I'm supposed to display well over 70 different rankings on every individual product's page.
Example: #23 best seller in China, #732 best seller in USA, #13 cheapest price in Norway, etc.
I've thought of various solutions to this problem:
- Create ranking fields - I guessed it wouldn't work since just a single drop in price would mean updating millions of rows to reduce their ranking field by 1 for example.
- Use COUNT - COUNT the amount of products cheaper than X : display ranking. I'm still considering this, however a single query takes 200 ms on average, so running 70 of them looks like it would take ages.
Really looking forward to advice from experienced database admins on this topic, as my knowledge feels very basic.
Additional information:
Hardware is dual Xeon CPUs, 15k RPM hard drives, 32 GB DDR3, LEMP stack, running latest Percona, all tables are XtraDB engine.
Aucun commentaire:
Enregistrer un commentaire