DEV Community

loading...

Discussion on: PostgreSQL vs MongoDB

Collapse
sirseanofloxley profile image
Sean Allin Newell

Splunk logs - logs and events are inherently non relational and perform much faster.

This does not generally apply to software, and in general, I would agree that non relational is almost never a good long term option for an app with any reasonable domain it is trying to model.

Collapse
rhymes profile image
rhymes • Edited

I would argue that a time series DB like InfluxDB is a better storage for timestamped logs and events than a document DB is.

Collapse
elmuerte profile image
Michiel Hendriks • Edited

A big part of logs are relational. It has a timestamp, host, application, log level, a message, and commonly a "category". The other data is less well structured between the various log event producers, lets call this "meta".
This meta data you could store in a less explicitly structures relation. It's usually a simple key->value structure anyway. For that you could use PostgreSQL's hstore.

But... I do not know if I would use PostgreSQL to store log events. Although PostgreSQL has native sharding these days. Setting up a distributed PostgreSQL farm is way more complicated. Log events are a good candidate for eventually consistent. Or even, never consistent is also acceptable. It is mostly appending entries, pruning old records, and occasionally performing a query. ACID is also no strong requirement.

Thread Thread
sirseanofloxley profile image
Sean Allin Newell • Edited

Nah, none of those fields are relational imo. Relational fields are like UserId, EventId, ParentId, etc. Pointers to other things.

If you want to build a relational logging platform be my guest, but I suspect there's a good reason why most of the big players in logging use NoSql or InfluxDB.

Collapse
chiefnoah profile image
Noah Pederson

Logs are indeed a case where I think this applies. MongoDB is absolutely the wrong tool to use for that though, there are much better data stores out there that properly handle timeseries data well.

Forem Open with the Forem app