• blackstrat@lemmy.fwgx.uk
    link
    fedilink
    arrow-up
    7
    ·
    5 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
      2
      ·
      5 months ago

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

    • thewebroach@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      5 months ago

      If there’s commonly used data that would be good for indexing or filtering, you can take a few key values and keep them stored in their own fields.

      There are also often functions that can parse structured text like XML or JSON so you can store data in blobs but not actually need to query all the blobs out to a client to use them on the database side and retrieve specific values. Another nice thing about blobs is the data can be somewhat flexible in structure. If i need to add a field to something that is a key/value pair inside a blob, i dont necessarily have to change a bunch of table schemas to get the functionality on the front end that I’m after. Just add a few keys inside the blob.