S
S
strangeletc2017-11-19 12:57:11
Database
strangeletc, 2017-11-19 12:57:11

How to store a list of data in a database?

Let's say there is a certain web service where the history of user sessions (or any other list of data related to a specific user) should be stored.
Postgres database.
Structure 1 record:
ID - user identifier
number - record number
status - activity status
IP - IP address
client - client information: OS, browser, etc.
country - user location
timestamp - timestamp
1 option - store everything in one table. The concern is that all the data is jumbled up on the heap. And if I want to store history up to the beginning of registration, then a huge number of records will be typed. What about removing an entry from the list? Just hang up the mark "deleted" and leave it in the database?
5a11517d01322865407741.pngOption 2 - each user has his own table and a list of his activities in it. It looks better, but as I understand it, creating tables while the service is running is not good.
5a1151f62871a028275309.png5a1151fd8dade822329523.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lega, 2017-11-19
@lega

The main question is what do you want to do with this data? what requests? what volumes?
But offhand, we can say that with large volumes, your options are not very effective: they will slow down, eat up the disk and RAM.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question