A
A
andre77772017-01-30 05:46:44
MySQL
andre7777, 2017-01-30 05:46:44

How to properly organize the database structure for a large directory?

Create a database of goods (not a store, but the principle is the same)
Site on laravel 5.4. Objects are supposed to be from 500k, categories up to 10, but for 20 cities, parameters per object are about 30.
The site will search by all parameters within one city (such as in the Yandex Market search module)
Questions:
1) how to organize the structure of the database, each city ​​- a separate table or all in one?
2) how to do a search, write it yourself or there are ready-made solutions (tell me if you come across)
I think there is a lot of similar information on the Internet, but suddenly someone did something similar and will share their best practices or just give competent advice or a link to an article.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Finsh, 2017-01-30
@Finsh

A separate table for: product, city, category, parameter
one-to-many relationship: category - product (category id in the product)
many-to-many: city - product, product - parameter (in the binder we store the parameter value for a specific product)
In the name of speed we use different tools such as search engines (sphinx, elastic, solr) or at first we manage the cache

S
sim3x, 2017-01-30
@sim3x

1) how to organize the database structure, each city - a separate table or all in one?
do not violate 3NF - all in one, all parameters in EAV or jsonb postgres
2) how to make a search, write it yourself or have ready-made solutions (tell me if you come across)
sphinxsearch.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question