News for hackers. Stuff that matters.
Re:JSON with Sqlite by darkpuma on Friday March 01, 2019 @01:18PM (#19283724)
> "Let's say you have a product with multiple labels: usually you'll get one line per (product, label) tuple so you'll have to do some job application side if you what to get one [product, labels] object per product."

What's the payoff of doing [product, labels], particularly if that means a json array of labels? I briefly investigated doing that for my application but I found that it would increase disk space (not really a big problem) but it would also make efficient querying a big chore (e.g. labels->products queries.)

I can see this being a good tradeoff if querying by labels is extremely rare and instead you only ever want to query product->labels. But that's still pretty damn fast with the (product, label) tuple schema.

Re:JSON with Sqlite by arkh on Friday March 01, 2019 @10:57PM (#19287465)
You don't change your schema to add some json field.

When querying you do something like

  select p.name, json_agg(l.value) as labels
  from product p, label l