logoalt Hacker News

hobsyesterday at 10:58 PM3 repliesview on HN

It still makes me sad when half the queries I see are json_* - I know its far too late, but a big sad trombone in query performance is constantly left joining to planner queries that are going to give you 100 rows as an estimate forever.


Replies

bastawhizyesterday at 11:52 PM

If the queries are sensible, you can always create indexes that index on the queried expressions.

https://www.postgresql.org/docs/current/indexes-expressional...

panzitoday at 12:28 AM

Not sure why those are json_agg() instead of array_agg() in that example. Why would you use a JSON array instead of a native properly typed array? Yes, if you have some complex objects for some reason you can use JSON objects. But those where all just arrays of IDs. Also why was it json_agg() and not jsonb_agg()? Is there any reason on why to use JSON over JSONB in PostgreSQL?

show 1 reply
NegativeLatencyyesterday at 11:19 PM

Hoping for more easy columnar support in databases, which is one of the things that can lead you to storing json in database columns (if your data is truly columnar).

Currently the vendor lock-in or requirements for installing plugins make it hard to do with cloud sql providers. Especially hard since by the time it's a problem you're probably at enough scale to make switching db/vendors hard or impossible.

show 2 replies