K
K
Khurshed Abdujalil2017-12-22 09:36:13
MySQL
Khurshed Abdujalil, 2017-12-22 09:36:13

How to design a database for a high-load project?

There is a project where there are products and categories, one vacancy can have several categories
done like this
1) category table (id, name, parent_id, ...) - 2 levels main categories and subcategories
2) product table (id, name, company_id ,...)
3) table product_to_category (product_id, category_id) category_id - these are subcategories
, but when selecting products of the main category, you have to write a query select * from product_to_category where category_id in (all subcategories of the main category) group by product_id - something takes a long time (group to cut off duplicates)
is it possible to create tables somehow differently, or rewrite the query?
records 20-50 million

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question