S
S
s_pyanov2022-04-19 11:30:09
Database design
s_pyanov, 2022-04-19 11:30:09

Database design, which DBMS to choose?

Good day!
You need to write a program for some of your needs. I began to think about the architecture of the database, I want to do it right, and not anyhow). It is assumed that there will be a data stream that consists of user, action attributes. And the user and action fields will be related keys to other tables.
625e6f59f0953223199481.png
Each user generates about 20-50 events per day, there can be a lot of users over time (several thousand, possibly more). The most frequent requests will be for a selection:
- Get all user events in a date range (usually 7 days).
- Search for a specific event given the user for several weeks / months.

This moment confuses me: with a large number of records in the "Events" table, there will be a drawdown for the queries written above, if there are several million records and queries will be 1k per day to such a table - probably there will be a high load? Perhaps it is better to organize the structure somehow differently? How about schemas in postgres? For example, a separate schema per user, and the actions table will be available to everyone in a separate schema. Then you get several thousand schemes. Is it convenient to maintain, does it incur additional overhead, or vice versa is it a good option?
Perhaps you need to go in the direction of time series bases - click house?

I am not a specialist in databases, especially in matters of load calculation and design - therefore, I ask you to refrain from toxic statements, but to help with competent advice from experts in this matter)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2022-04-19
@s_pyanov

if there are several million records and requests will be let 1k per day to such a table - there will probably be a high load?
no load, take the DBMS that you like best
For example, a separate schema per user
stop inventing, you need to deal with optimization when you know the bottleneck
Threat in short, without real experience, such “I want to do it right, and not anyhow” is almost impossible, you just need to do it, fill in the data and start using it, then you will understand all the problems

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question