r/programming • • Sep 24 '20

PostgreSQL 13 Released!

https://www.postgresql.org/about/news/2077/
1.3k Upvotes

236 comments sorted by

View all comments

60

u/tomma5o Sep 24 '20 edited Sep 24 '20

Sorry FE dev here, why you guys prefer postgreSQL over mySQL?

103

u/FREEZX Sep 24 '20

I prefer Postgres for it's JSONB storage and indexing, basically allowing it to take any JSON data as a field and quickly look things up. I see it as having benefits of NoSQL databases while keeping it relational.

4

u/Dokiace Sep 24 '20

is this JSONB storage a new thing implemented in postgres?

14

u/mobydikc Sep 24 '20

version 9.4 I think.

6

u/Dokiace Sep 24 '20

So it's been out for a while huh, how come I never heard of this, so you can just INSERT <JSON> into TABLE and it will handle that?

17

u/booboorocks998 Sep 24 '20

They get inserted like strings. But the column type has a bunch of special features, like you can query into the json for your select or check a value in the where.

https://www.postgresqltutorial.com/postgresql-json/

2

u/Dokiace Sep 24 '20

is this not implemented widely in the industry? I dont have that much professional experience but I haven't seen this one implemented anywhere in the production

10

u/booboorocks998 Sep 24 '20

Not likely if your database has been around for more than a couple years.

Even Microsoft SQL Server supports json columns now though, so it's sort of picking up.

When you use that type, you trade off most of the benefits of relational data. So it is only really great for some use cases. But for those use cases, it is awesome!

It's also a nice way to just store blobs of data in a database rather than a file system or cloud storage. You don't lose out on the relational features since you wouldn't have them with the alternatives anyways.