S
S
Sergey Shcherbakov2015-01-11 19:36:04
PostgreSQL
Sergey Shcherbakov, 2015-01-11 19:36:04

How to store user data in the database?

Good evening.
Not so long ago I started learning Django (and web development in general) and decided to write a small note-taking service for my local network as a learning project. And the question, in fact, is this: how to properly store user data in the database?
For example: there is a note, it has a name, text, tags and other fields, as well as a column in which the id of the user who created the note will be stored, and according to this column I have to make a selection, is this correct and are there any other methods? Suppose there will be a lot of notes sooner or later, how quickly will the base grow with this method? In addition, for example, if I want to implement the insertion of an image into a note, where should I store it? In the file system, but in the database only a link to it?
Please tell a newbie. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rishat Kadyrov, 2015-01-11
@nesh_nedvin

  1. The base in your case grows linearly, so you should not worry. However, databases are different from all other storage methods (for example, csv) in that they can withstand a huge amount of information.
  2. Don't forget to index on the user id column.
  3. The tags are usually stored in another table (and another table for many-to-many relationships).
  4. Most often they store a link to an image, of course. But for example, for GAE it is more correct to store images in the database. However, this is not your case, keep the links.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question