• ColonelThirtyTwo@pawb.social
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    SQL blows for hierarchical data though.

    Want to fetch a page of posts AND their tags in normalized SQL? Either do a left join and repeat all the post values for every tag or do two round-trip queries and manually join them in code.

    If you have the tags in a JSON blob on the post object, you just fetch and decide that.

    • blackstrat@lemmy.fwgx.uk
      link
      fedilink
      arrow-up
      0
      ·
      2 months ago

      I’m no expert in JSON, but don’t you lose the ability to filter it before your application receives it all? If you had a reasonable amount of data then in SQL you can add WHERE clause and cut down what you get back so you could end up processing a lot less data than in your JSON example, even with the duplicated top table data. Plus if you’re sensible you can ensure you’re not bringing back more fields than you need.

      • Ephera@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        2 months ago

        In a traditional SQL database, yeah. In various document-oriented (NoSQL) databases, though, you can do that.