Z
Z
z0ng2019-07-10 20:47:13
PostgreSQL
z0ng, 2019-07-10 20:47:13

Which database to choose for a video service by the type of VK video section?

The service has a central section with videos, from where users can add videos they like to their profile, attach tags to the video (each user has his own tags that he creates). Sample options:

  • Just all user videos
  • Video by tag
  • Search by title among all videos on the site
  • Search by title among all user videos

All options are sorted by date added.
So far, I have chosen 2 possible DBMS for myself - Postgresql and Mongodb.
Everything is more or less clear with the Postgres architecture - there are tables with video, with tags, and an intermediate table for video and tag. Of the minuses - it is not very convenient to edit tags for a video in a bundle, i.e. when a user adds some tags to the video in one request, and removes some. All this generates unnecessary queries to the database. Perhaps you should store the tags inside the json field in an intermediate table? Will sampling work quickly?
In Mongo, this can be implemented more conveniently, but it is not clear how to store the videos themselves - in a separate collection of videos and in a separate user, and store video id's and tags inside the user? Will such a selection work quickly if you pull out all the user's videos by tag?
What would you choose and why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Kudryavtsev, 2019-07-11
@Deissh

Premature optimization almost always hurts, if mongo, then yes, store separately, but indexes are needed otherwise it will take a long time. There are bulk and aggregate queries in order not to generate a bunch of queries. To work with tags, you can use $push and $pull to add/remove tags one by one.

D
Dimonchik, 2019-07-10
@dimonchik2013

ArangoDB

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question