A
A
andrey_270812021-02-10 22:42:58
Database design
andrey_27081, 2021-02-10 22:42:58

What is the best way to store information about ads?

I'm developing a classifieds board, and I'm faced with the question of how best to store ad data.
I have several

post tables - basic information
img_post - links to ad pictures
post-attr - attribute names, and type
post_attr_value - attribute values, I associate with the attribute table and post

When adding an ad, for each I create a file with a json array to pull from information, and not a million requests to make to the database when opening the ad page. (I lay out the files / region / city / marka / model / id_ads.json)

So the question is, will this board fall if there are about 100k ads?

Let's say 1000 people come in and use filters, and these are all queries to the database (in 3 tables at the same time), will there be an overload?

Or maybe there are some methods for building sql queries so as not to load the database heavily?

It is very interesting how the system works on the drome, olx, avito, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Mirilaczvili, 2021-02-12
@2ord

Let's assume that a lot of people look at the message board and they see the same ads. Doesn't this suggest the need for caching ads? Each filter is its own set of ads. And if frequently requested, then it will almost regularly be in the cache.
The file solution doesn't scale well and use a DBMS instead. Get Mysql 8+ or Postgresql (9 seems to be) with JSON support. Add indexes to the required fields.
You need to build tables in such a way that there is less JOIN, that is, partially denormalize the data if it is designed for frequent queries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question