I have database with about 50k (and counting) products. Further, users on my website have declared the country of their origin.
Now I need to add to products fields like allowed_countries
and blocked_countries
.
- Product can have these fields empty - it will be shown to all users,
- Product can have
allowed_countries
filled - it will be shown onlyto users from that countries, - Product can have
blocked_countries
filled - it will be shown to all users, except users fromblocked_countries
list.
Such filtering should apply in product catalog, product page and searcher (currently full text search).
How to efficiently design a database for such requirements? What I am caring is performance under quite big load. I was thinking about dynamic columns in MariaDB 10.0.20, but I am not sure about speed of filtering by exactly one country.