5 reasons why i'm using PostgreSQL instead of MongoDB

preview_player
Показать описание
I've been using MongoDB as my go to database for side projects for many years. I've now changed that and when i need a database now, i reach for PostgreSQL. In this video i go through 5 reasons why did the switch to PostgreSQL.

Links to resources mentioned in the video:

Chapters:
00:19 1. One version you rule it all!
00:45 2. Structured query language
01:28 3. Modern features (lots to explore)
02:22 4. Point in time recovery
03:19 5. Great performance
Рекомендации по теме
Комментарии
Автор

1. One version you rule it all
2. Structured query language
3. Modern features (like json, geo queries, graph lookups)
4. Point in time recovery (rollback)
5. Great performance

MohamedAllamTech
Автор

My last job was using Postgre json b for everything, so flexible, and cuts down on so much time mapping everything out to fields etc.

williamhammock
Автор

Didnt know about those displaying as JSON features on postgres, thats really cool, ill def. take a look into that

ikazuchi-san
Автор

lot's of things i didn't know about like PostgreSQL's point in time recovery. and i didn't know MongoDB had a separate crippled version

xybersurfer
Автор

Postgres can also do realtime stuff using the LISTEN and NOTIFY functionality

boot-strapper
Автор

I am in dillema... Want to create something but don't know which one is better for database... Sql or mongodb? 🤔

mitotv
Автор

Am I crazy in noting that certain features of postgres are really annoying? Such as not being able to do a select all except column query or the fact that default value functions can't reference another row. I haven't read anyone pointing this out yet, but it seems to be one thing that mongodb really does better. That being said, they're both pretty fantastic, though I'm kind of hoping surrealdb takes off.

chinaboytag
Автор

Hello! Where can I learn postgres well? All courses on udemy seem very basic and introductory. For example you converting normal rows into json sounds so cool. I always use postgres but I am not good at it. Is there a course you could recommend?

SandraWantsCoke
Автор

This video inspired me to use PostgreSQL jsonb support instead of MongoDB as query database. Sure, Mongo is distributed and can scale but my app is not that big so postgres gonna cut it.

IvanRandomDude
Автор

How are job opportunities for postgres DBAs?

indude
Автор

Do we have something like atlas in postgres?
How to you migrate database from one server to other?

siyaram
Автор

Mongodb allows you to horizontally scale! For a while in SQL world you can only vertically scale. I'm not sure if that has changed. Also running MongoDB in cluster mode is just a breeze. The information on running postgres in cluster mode seems very limited. Also storing nosql data in SQL data seems like such an anti pattern.

_dinesh
Автор

I think that there are pro and cons for both ! Those json things came far later on postgresql whereas mongodb was build on that idea and also the fact that mongodb is schema-less by default (big advantage for companies who don’t want to store relational data. Mongodb is also big in the enterprise world what make it “business” compatible (become more and more popular). PostgreSQL isn’t making any money (thanks to them) whereas mongodb is a company working for companies (like redhat for example). Note that I really love PostgreSQL especially with those recent json/jsonb things. It’s really powerful and flexible. So, let’s conclude that both have their own “use cases”. Ps: that jsonb came probably of that mongodb BSON idea btw.

soufianta
Автор

I'm still not understanding how this is different from MySQL

thespicehoarder
Автор

I used to work with MongoDB - for some 4 years, and now for 6 months I am working with Postgres - I hate Postgres, complete with the SQL. The level of complexity Postgres adds is enormous, it lack sharding, it scales only vertically, the only way to keep Postgres in production is RDS or any other managed DB service - which is much-much pricier than Atlas. As NodeJS developer with Mongo I have single techology streamlined stack. With Postgres - I need write queries, or use ORM - which also adds to the complexity and often not suitable for production.

TheHellishFrog
Автор

Me: maybe i should try learning Mongo
Youtube: why Postgres is better
welp, nevermind then.
didn't know about point in time recovery, that seems really useful.

maplmage
Автор

Choice depends on what your app needs to be honest. MongoDB is good for if you really need flexible databases

bigbadcatbigbcy
Автор

Hey y'all... I just wanted to share the code he used to make for his example. I was having a hard time understanding because of all the aliasing and renaming and overwriting of them. Hopefully this helps:
CREATE TABLE users (
id BIGINT PRIMARY KEY,
name TEXT NOT NULL
);
INSERT INTO users VALUES (1, 'Christopher');
INSERT INTO users VALUES (2, 'Lindblom');
INSERT INTO users VALUES (3, 'allan');

CREATE TABLE tags (
id BIGINT PRIMARY KEY,
user_id BIGINT NOT NULL,
value TEXT
);
INSERT INTO tags VALUES (1, 2, 'age');
INSERT INTO tags VALUES (2, 2, 'name');
INSERT INTO tags VALUES (3, 1, 'age');
INSERT INTO tags VALUES (4, 1, 'skill');

-- my_tags
select DISTINCT t.user_id, (
select jsonb_agg(_)
from (select id, value from tags as tt where tt.user_id = t.user_id) as _
) as my_tags
from tags t;
-- below line doesn't work because out of scope
-- select * from my_tags;



with user_tags as (
select DISTINCT t.user_id, (
select jsonb_agg(_)
from (select id, value from tags as tt where tt.user_id = t.user_id) as _
) as my_tags
from tags as t
)

select u.id, u.name, COALESCE(t.my_tags, '[]'::jsonb) as other_tags
from users as u
-- user_tags is in scope because of "with" keyword
left join user_tags t on (t.user_id = u.id);

xorlop
Автор

authors has no idea what is the purpose of sql/nosql or CAP theorem. very naiv way to decide what database is suitable for specific archicture. but anyway thanks for sharing.

kotojava
Автор

There is a company behind MogoDB. They created a lot of hype (via huge marketing campaigns) to sell this product. Whereas Postgres is an open source and free product. Nobody is doing any marketing for Postgres. Nobody gives a damn if you use or do not use Postgres. But Mongo people loose profit if people stop using it.

anonymous_anonymity