837
JSON Query Language (programming.dev)
you are viewing a single comment's thread
view the rest of the comments
[-] blackstrat@lemmy.fwgx.uk 7 points 1 month 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.

[-] mousetail@programming.dev 3 points 1 month ago

It's entirely possible to sort and filter inside JSON data in most SQL dialects. You can even add indexes.

[-] thewebroach@lemmy.world 2 points 1 month ago* (last edited 1 month 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.

[-] Ephera@lemmy.ml 2 points 1 month ago

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

[-] snowfalldreamland@lemmy.ml 5 points 1 month ago

Modern relational databases have support for it too including indexes etc. For example postgres.

[-] mousetail@programming.dev 2 points 1 month ago

Every major SQL database supports json manipulation nowadays. I know MariaDB and MySQL and SQLite at least support it natively.

this post was submitted on 27 Jul 2024
837 points (97.8% liked)

Programmer Humor

19166 readers
644 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS