A
A
AG152015-04-14 13:29:08
PostgreSQL
AG15, 2015-04-14 13:29:08

What is the best way to organize the storage of data on received applications in the database?

There is a landing page page, on it there are several forms, when sending them on the server, I will store the entity - the application from this form. The application will have the time, the name of the form, as well as the completed form fields, but in some of these forms there is only a number entry field, in some there is also a number entry field and a name and mail, or only mail, the user's IP is also attached to the application, its user-agent and referer.
The name and description of the form must be stored on the server, and when submitting the form, its ID and, accordingly, the fields will be transmitted. Is it worth storing it in a relational database, creating several tables for normalization, or just put each request in mongoDB as JSON'a?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Yarosh, 2015-04-14
@voidnugget

You need to understand that even if you store JSON in PostgreSQL under a gin index, it will be faster than Btree in Mongo. Because using index with vodka ! JSON in PostgreSQL may not be normalized, there is a flyweight template, so it will not store anything extra - see examples of work. But in relational tables, some kind of enum thread will be more than enough, although I usually don’t be lazy, and create a bunch of tables with id name + unique, and a separate ts field for searching.

V
Vadim Shandrinov, 2015-04-14
@suguby

See how you handle it. To store in a monge is raw data, you will have to write your own handler.
In a relational DB to store - it will be possible to extend with sikulami. To begin with, make one table in the database with all possible fields, and indicate that not all fields are required and write everything that comes from the form into this table. Then you will process the data using standard sikuls or ORM (what PL do you have?).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question