soulpaul
soulpaul

Reputation: 172

Designing a database to gather statistics for a digital product

I'm building a digital product for a big community of users (2 million +), using Express + GraphQL for the API server and React + Apollo for the web app. Then I'm going to build mobile applications using React Native when the web part is completed.

Right now I'm struggling thinking how to develop the part that is going to gather all the statistics for the user generated content in the platform. To simplify things let's say I have to record:

I have a couple of questions for those who had previous experience in developing such systems to gather data.

How should I record the raw data? Should I create a kind of a log in a database and use that later to generate aggregate data depending on my needs?

Something like (article view example):

{
    'user_id' : String,
    'article_id' : String,
    'date' : Date,
}

or should I use a different approach? And which database you recommend to use? Right now I'm thinking about using MongoDb since I'm already using it for the rest of the application.

Upvotes: -1

Views: 106

Answers (1)

serge
serge

Reputation: 1022

Indeed there is no single "right" solution but some approaches may be chosen. I'd like suggest the combined approach used in several of my projects: store the most significant (and queryable) part of data as structured but put also raw data as semi-structured. The DBMS like SQL Server (faster but limited in free edition) or PostgreSQL (slower but may be sufficient) can do the job. You may take a look at the chapter "Semi-structured data and high load" in my book for more details.

Upvotes: 0

Related Questions