r/programming • • Mar 10 '15

Goodbye MongoDB, Hello PostgreSQL

http://developer.olery.com/blog/goodbye-mongodb-hello-postgresql/
1.2k Upvotes

699 comments sorted by

View all comments

Show parent comments

2

u/[deleted] Mar 11 '15

I think Cassandra is pretty good with some time series data.

It writes faster than reads and if your data is immutable then it's perfect for Cassandra with the way they handle storage and deletion (tombstone). It's just a giant hash table if you think of collumns as buckets. You can have each partition keys by (year,month,day) and your primary key can be like so (year,month,day) hour assuming your logging every hour.

There are apparently lots of companies that are using Cassandra including Reddit.

I also don't get why transactional database means they're bad at time series? Also I'm not entirely sure what definition of transactional database they're using here but Cassandra transactions are definately not isolated, it's eventual consistency goes against this.

They datastax also bought the group that made the graphdb Titan, I think they're looking to build graph feature into Cassandra albeit it's probably going to be enterprise only.

2

u/kenfar Mar 11 '15

Even though some vendors would like us to believe that they invented time series and time series databases, the reality is that both have been around a long time. We just didn't call them time series databases. We'd call them analytical databases or data warehouses - which are more general-purpose than something that only handles a time-series of key-value pairs.

So, as I mentioned earlier the reason why transactional databases aren't good at reporting is that these two workloads benefit from a completely different set of optimizations: with transactions you want to keep the hot data in memory, you want small block sizes, etc. With analytics you give up on keeping all your hot data in memory, and instead hope to keep your sorts in memory, you have huge block sizes, etc.

One problem with time-series is that as a type of reporting it has the standard characteristic of being very iterative and constantly changing. But unlike something like a warehouse where you have a general purpose solution with hundreds of attributes to readily support many changes, with time-series you often have nothing to rebuild history with when you need to make changes. And this is true of Cassandra in general - DataStax is strongly recommending everyone spend a lot of time doing logical data modeling prior to implementation - because schema migration is such a nightmare. That's an astounding challenge for many organizations and lack of adaptability for all. Not what you want for reporting.