Zeeshan Saleem
Most large chat apps actually use a mix, or specialized databases. Discord, for example, famously switched to ScyllaDB (a Cassandra rewrite) because they write billions of messages a day. For a startup, though, Postgres is incredibly capable and can easily handle millions of rows before you need to worry about sharding.
Zeeshan Saleem
I agree. Start with Postgres. You can even use the JSONB type in Postgres if you need flexibility for message metadata (like reactions or attachments) without giving up ACID compliance.
I am building a real-time chat application similar to WhatsApp or Discord. I am trying to decide on the database. NoSQL (like MongoDB) seems great for storing flexible JSON messages, but SQL (Postgres) is more reliable for relationships. What do big apps use for their message history?