Why does NoSQL exist? (MongoDB, Cassandra) | System Design

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2024

Комментарии • 20

  • @professionalsd9647
    @professionalsd9647 23 дня назад +22

    I'm i missing something or he didn't design the model in nosql ?

    • @ssefrhd
      @ssefrhd 23 дня назад +3

      Exactly my thought as well..

    • @interviewpen
      @interviewpen  23 дня назад +2

      The schema shown is just an example to show the limitations of the relational model. Point is, NoSQL databases allow us to design around query patterns. The same logical data could result in very different schemas depending on the requirements or which database we choose. If you want to learn about non-relational schema design, you might want to look at our course on interviewpen.com :)

    • @mindrust203
      @mindrust203 23 дня назад +10

      @@interviewpen True, but I think I speak for most of us when I say we were expecting to see how you would design the NoSQL data model to solve the issues you mentioned, with regards to querying products in an order and getting the number of times a product appears across all orders.

  • @Fikusiklol
    @Fikusiklol 23 дня назад +6

    Good stuff!
    However, what is also important apart from schema, that relational database has relatively slow writes/updates because of their index structure (B-tree) and storage mechanisms.
    Apache Cassandra, afaik, has LSM tree and mem tables.
    MongoDB has async I/O journaling and also has LSM tree (or does it?) in addition to B-tree.
    I, personally, dont like any relational DB, but "right tool for the right job" :)

    • @charliebitmyfinger7124
      @charliebitmyfinger7124 22 дня назад +3

      Relational databases are also acid compliant and are by far the most reliable types of databases.

    • @Fikusiklol
      @Fikusiklol 22 дня назад

      @@charliebitmyfinger7124 NoSQL database are also acid compliant. It depends on what guarantees they provide, as every engine provides different guarantees.

    • @interviewpen
      @interviewpen  21 день назад

      Really great insights, thanks!

  • @ChoocoPunch
    @ChoocoPunch 10 дней назад

    Can I ask what should a NoSQL database table schema look like?
    Should it looks like 0:05 ?

  • @goldenlin9528
    @goldenlin9528 23 дня назад

    do most large scale companies use nosql then in favor of ease of storing and accessing data?

    • @interviewpen
      @interviewpen  21 день назад

      Yep--companies that need to query massive amounts of transactional data typically use NoSQL databases for flexibility when distributing data across a large cluster.

  • @optimusdebugger9638
    @optimusdebugger9638 16 дней назад

    nitpick. We lost quantity when we went from model to table on order_product table

  • @ehm-wg8pd
    @ehm-wg8pd 23 дня назад +1

    this is gold

  • @ibrahimkoz1983
    @ibrahimkoz1983 20 дней назад

    Postgresql offers the same power as MongoDB when it comes to json, so there's no sense to choose MongoDB even if you want to store your data in denormalized form.

    • @ibrahimkoz1983
      @ibrahimkoz1983 20 дней назад

      @codingwithjamal nope. Postgres stores json as jsonb and it is blazingly fast.

    • @interviewpen
      @interviewpen  6 дней назад

      From my understanding, postgres doesn’t have the same ability to select or filter on json fields. But regardless, using a solution that was designed from the ground up for this use case will generally result in a better experience. Thanks for the insight!

    • @sharmanihal
      @sharmanihal 16 часов назад

      @@interviewpen Postgres can quite nicely filter/search/index the json fields; however, this only does not make it an ideal candidate to choose over MongoDB.

  • @saiyijinprince
    @saiyijinprince 18 дней назад

    I think you missed a huge aspect about when you to choose between SQL vs NoSQL. At the end of the day, its more about picking the right tool for the job, and less about the scale of the data. If you need ACID transactions, use SQL. If you're okay with eventual consistency then NoSQL might be easier. The scale of your data is just one minor aspect you need to consider when building a system. I'd argue you can scale both types of DBs just as much as each other but it'll all come down to what kind of trade offs you're willing to make. Its not uncommon to have a combination of both NoSQL and SQL DBs, they are not mutually exclusive.