News for hackers. Stuff that matters.
Re:New in PostgreSQL 10 by davedx on Thursday September 21, 2017 @03:48PM (#15306753)
How does PostgreSQL 10 compare with Cassandra for BigData requirements?
Re:New in PostgreSQL 10 by manigandham on Thursday September 21, 2017 @08:01PM (#15308322)
They are completely different:

Postgres - Solid single-node relational database with SQL standards support, JSON, fulltext search, custom data types, ACID transactions, foreign data access, and more. HA/scaling through replication and some 3rd party offerings for automatic sharding, failover and multi-master if you need it. Great as the operational source-of-truth for your core data.

Cassandra - Distributed wide-column (basically advanced key/value) meant to run as a cluster of machines with native support for multiple data centers. Limited "SQL" support which is really only used for defining tables. Data access is very different (everything is an upsert or delete) with variable per-query consistency settings. Great if you need data spread globally, 100% availability, eventual consistency fast key/value, and some interesting data access patterns.

If you want high-performance Cassandra, look at ScyllaDB first. If you need something in between Cassandra and Postgres, look at CockroachDB.

Re:New in PostgreSQL 10 by noncoml on Thursday September 21, 2017 @03:58PM (#15306826)
By no means an expert, but isn’t it Apples and Oranges?

Cassandra is an eventual consistent database.

Postgres is ACID.

My 2c: you don’t need Cassandra or other BigData databases. If you did, you probably wouldn’t ask the question.

Re:New in PostgreSQL 10 by peatmoss on Thursday September 21, 2017 @04:21PM (#15306991)
> you don’t need Cassandra or other BigData database. If you did, you wouldn’t ask the question probably.

...and by the time you do, Postgres improvements will have rendered your Big Data medium-sized anyway :-)

Re:New in PostgreSQL 10 by fortytw2 on Thursday September 21, 2017 @07:27PM (#15308162)
you can comfortably fit 8TB of data on a single box running postgres, more dependent on your hardware :)
Re:New in PostgreSQL 10 by riku_iki on Friday September 22, 2017 @05:55PM (#15316204)
Curious, how long it will take to create index on single node for a such large table?
Re:New in PostgreSQL 10 by kstrauser on Thursday September 21, 2017 @07:50PM (#15308253)
That's about 1/250th of our working set size. :)

Of course, that's in a Spark cluster running massively parallel queries and not on a single (however large) node.

Re:New in PostgreSQL 10 by ibotty on Friday September 22, 2017 @02:26AM (#15309834)
You did not ask that question. I assume you knew before that PostgreSQL is not the tool for your workload.
Re:New in PostgreSQL 10 by kstrauser on Friday September 22, 2017 @02:34AM (#15309858)
I didn’t ask a question. I love PostgreSQL for small relational stuff (where “small” is up to a few TB) and use it any time it’s appropriate. I wouldn’t classify it as a Big Data store, though.

That’s no criticism at all. I wouldn’t use Spark for a transactional DB because it’s not the best tool for the job. Same for PostgreSQL when the dataset grows far beyond what a single instance can reasonably process.

Re:New in PostgreSQL 10 by wjossey on Thursday September 21, 2017 @04:29PM (#15307039)
Having provisioned these sorts of "big data" systems in the past, it's now about how much you have today, it's how much you'll have over a growth period. The advantages of a scale-out system like cassandra, riak (RIP), memsql, big-table, cockroach, etc., are that they can grow with you from 3TB, to 9TB, to 81TB (as an example, if you're on some exponential growth curve with your data). It's not that you can't do it with Postgres and MySQL via sharding, it's that you don't have to if your access patterns match one of the models that one of the above databases fits well within.

So, that person above may not need it today, but they may need it sooner rather than later.

Re:New in PostgreSQL 10 by noncoml on Thursday September 21, 2017 @04:40PM (#15307145)
Designing for the future is a guaranteed project failure.

If one is starting a new project, hence contemplating what DB to use, starting with an ACID db is a safe bet in most cases(unless of course they are already starting with a huge amount of data).

By the time the outgrow the ACID database they will have a better idea of what exactly they need and more importantly they will have the resources to make the switch.

BTW: riak is hopefully not dead yet, let's see what bet365 can do with it..

Re:New in PostgreSQL 10 by wjossey on Thursday September 21, 2017 @04:52PM (#15307247)
I don't think we disagree, but I want to be cautious about saying "whatever we start with is always good enough."

I'm co-founder of a company, doing all of the technical work, and I too am using a very vanilla stack: Postgres, Elasticsearch, Redis, Memcache, Rails. However, having worked on massive scale-out projects before, I recognize where my pain points are going to be with my tech choices.

[1] I'm storing calendar data in postgres. This data is primarily key/value based, needs to be persistent, and on a per user basis potentially is tens of thousands of records. This is a medium term problem, and I'll likely move this data out of postgres and into a scale out solution sooner rather than later. I need relatively fast lookup times, but this is primarily a "high write, low read" scenario, that Cassandra is well suited for.

[2] I'm storing a bunch of text from blog posts, news articles, etc., in Postgres. I really dont' need the data to be in postgres, it's just a handy place to store it to synchronize with Algolia & Elasticsearch, where the true work happens. However, I dont' want to hold onto TBs & TBs of news articles in a postgres system. As that system scales out, it'll be unnecessarily expensive, as I don't need all the bells and whistles I'm getting from Postgres, for what is effectively a form of cold storage. This is a long term problem, and I likely won't tackle it for well over a year.

So, you're right, I'm not contemplating what DB to use, but I'm definitely aware of why I won't just leveraging the same database in perpetuity. Being focused on delivering customer value is vital, and that's my intent; however, scalability and cost structure do matter over the long term, so an understanding of where one will go is good as well.

Re:New in PostgreSQL 10 by simonw on Thursday September 21, 2017 @05:15PM (#15307411)
Have you considered Citus as your scale-out solution? https://www.citusdata.com - maybe you can have your PostgreSQL and eat it too.
Re:New in PostgreSQL 10 by wjossey on Thursday September 21, 2017 @06:15PM (#15307811)
Citus seems really cool (this is not a critique of the product), but probably not something I’d use. They seem to be very close in feature set to bigquery, and if I have to choose between the two bigquery wins for me. There are definitely situations where citus is a better solution, but I think the scenarios where I could need a scale out analytics platform, I’d choose BQ. Still, very supportive of what they are doing at Citus. It’s great.
Re:New in PostgreSQL 10 by manigandham on Thursday September 21, 2017 @07:55PM (#15308283)
MemSQL would be the on-premise alternative to BigQuery, RedShift, Snowflake and the others.

Citus is more focused on scalable OLTP rather than OLAP scenarios, giving you essentially an automatically sharding postgres database. Heap does use it for analytics but that's more so because of the JSON support and indexing in postgres itself.

Re:New in PostgreSQL 10 by wjossey on Thursday September 21, 2017 @10:04PM (#15308898)
I’m not sure I agree with this statement. BigQuery is not in memory, nor is redshift (not super familiar with snowflake). Whereas memsql is and would be prohibitively expensive to operate on datasets that are analytics based, because it is in memory based. It’s my understanding that citus is best suited to analytics workloads and parallel queries, and really isn’t comparable to memsql as it is attempting to provide scale out support with disk, which memsql doesn’t natively prefer.

Can you share some docs with me around how citus is more OLTP based? Looking to be educated.

Re:New in PostgreSQL 10 by manigandham on Thursday September 21, 2017 @10:47PM (#15309080)
MemSQL has in-memory rowstores and disk-based columnstores. Every columnstore table has a rowstore to aid in fast data ingest. Rowstores are meant for access of individual rows, lots of data updates, and smaller reference tables while columnstores are for the bulk of data requiring large scans and analysis. We have tables with 20 billion rows that take up < 10gb of memory.

BigQuery streaming ingest also uses in-memory buffering into BigTable until it's written to disk, just like Cassandra with memtables flushed into on-disk SSTables.

Citus is more manual work than MemSQL and doesnt support columnstores native, although you can use it with their cstore extension to get both. It's just a different design giving you a postgres database that automatically shards vs MemSQL's many optimizations around HA, replication, and very fast analytics performance.

Try the features page: http://www.memsql.com/features/

Re:New in PostgreSQL 10 by wjossey on Friday September 22, 2017 @10:38AM (#15312562)
Thanks for the education on MemSQL. I wasn’t aware of the analytics use case (had never come up in discussions I was a part of for that tech), so it was news to me.

This article had a nice overview. Somewhat outdated but mostly still up to date. https://lnkd.in/g4anCf5

I’ll say it seems precarious to me to mix and match row store in memory data with a columnar store. Is it never a performance issue to have these two systems potentially in contention with one another for resources?

Re:New in PostgreSQL 10 by manigandham on Friday September 22, 2017 @01:25PM (#15314054)
It's just data in memory. Rowstores are read from memory and columnstores are read from disk. The architecture uses leaf nodes and aggregator nodes so aggregrator memory is used for assembling the final results of a query.

Version 6 is even faster, you can try out the beta: http://www1.memsql.com/beta-6.3-features.html

Re:New in PostgreSQL 10 by ddorian43 on Friday September 22, 2017 @09:47AM (#15312098)
Every BigQuery query, actually loads all the data (for that query) in-memory until it finishes.
Re:New in PostgreSQL 10 by noncoml on Thursday September 21, 2017 @05:04PM (#15307331)
Agreed
Re:New in PostgreSQL 10 by threeseed on Thursday September 21, 2017 @06:03PM (#15307743)
> Designing for the future is a guaranteed project failure.

Based on what ? There is no evidence or logic behind this.

If you know that you are producing say 1GB a day of data that you must store then it is sensible and prudent to select a technology that can support your needs a year or two from now.

And this idea that you always have resources to make a switch later on is rarely the case. The more common scenario is that a team is established to implement something, it moves into production and then the team either disbands or moves onto something else. Why do you think so many people try and plan for the future ?

In most enterprise companies at least it would be considered a failure to have a project that in a year's time required another business case just to replace the database that the team should've appropriately selected in the first place.

Re:New in PostgreSQL 10 by noncoml on Thursday September 21, 2017 @06:50PM (#15308005)
Knowing that you will hit the limit of the database in X years is different.

Designing for the future is a horrible choice because where do you stop?

Eg. Why are you sure that Cassandra, or whatever you choose, will be good enough for the future? Maybe you will need a Spanner type database or something even more big/consistent/feature-full.

Re:New in PostgreSQL 10 by davedx on Friday September 22, 2017 @02:13AM (#15309780)
> Designing for the future is a guaranteed project failure.

Yes, I understand this. I would not want to get bogged down on infrastructure when trying to deliver early versions of a product. At the same time, I think database choice is one of the more important tech stack decisions you should make early on.

Cassandra also sounds like a good bet for the type of data I'm interested in storing (ML model inputs, so lots of key -> numerical value data). But my experience is mostly around RDBMS and some NoSQL. Hence the question. Thanks for the answer!

Re:New in PostgreSQL 10 by noncoml on Friday September 22, 2017 @04:31AM (#15310307)
> ML model inputs, so lots of key -> numerical value data

How big are the numerical value data? AFAIK Cassandra does like large amount of data per value. https://docs.datastax.com/en/cql/3.3/cql/cql_reference/refLi...

Also what do you expect the total amount of data to be?

BTW, I just recommended to start with PostgreSQL because it just works and will have your back no matter what ways you like to use retrieve you data.

However if you are absolutely sure you don’t require secondary indexes, joins, etc, and just need a KV database, Cassandra will work fine too.

Re:New in PostgreSQL 10 by Thaxll on Thursday September 21, 2017 @04:45PM (#15307183)
No it's not, say that have 2TB of logs daily, good luck designing that with a regular RDMS without sharding / clustering / re-balancing capabilities.
Re:New in PostgreSQL 10 by jacques_chester on Thursday September 21, 2017 @06:58PM (#15308038)
I expect either of Citus or Greenplum can deal with that kind of volume. Citus acts as an extension, Greenplum is descended from an earlier fork (now merging its back to mainline as part of overall development).

Citus specifically cite analytics and write throughput as their strengths. I believe them. They do seem to charge for shard rebalancing and some other features.

Greenplum comes with an inbuilt data science toolkit (MADlib) and has a long history of dealing with intensive workloads. I don't know if there is a commercial version with extra features. I don't think so, but I haven't looked closely.

Greenplum also gave birth to HAWQ, which uses the Greenplum distributed/parallel query planner to plan queries over Hadoop.

Disclosure: I work for Pivotal, we do most Greenplum development.

Re:New in PostgreSQL 10 by user5994461 on Friday September 22, 2017 @05:11AM (#15310448)
And citus will be a nightmare to setup and maintain, for what elasticsearch could have done easier and better out of the box. Use the right tool for the job.
Re:New in PostgreSQL 10 by jacques_chester on Friday September 22, 2017 @07:36AM (#15311176)
I was pointing out that 2TB/day is not a very high write volume for modern OSS RDBMSes, especially distributed ones.

As for elasticsearch, I have found it to be temperamental. The "out of the box" experience was usually unhappy. For logging I've seen people move to other tools (splunk, stackdriver) more than once.

Re:New in PostgreSQL 10 by user5994461 on Friday September 22, 2017 @11:58AM (#15313313)
I have found elasticsearch to be one the easiest database I ever had to setup and maintain. Some tuning to do when you have TB on multiple boxes but nothing hardcore.

2 TB/day is fairly easy... as long as you have a bit of experience AND one of the database that can scale horizontally AND the company buys the amount of hardware that is required.

StackDriver/Sumologic/logentries are cloud solutions, so obviously one doesn't have to deal with the database ever.

Re:New in PostgreSQL 10 by jacques_chester on Friday September 22, 2017 @07:27PM (#15316864)
I think it's anecdote vs anecdote, but clearly you have more experience. In a fulltext indexing situation I'd probably look at elasticsearch again; I don't deliberately hamstring myself to try and be right on HN.

On the other hand, if I have structured-enough data, I'm going to prefer relational tools for it. Hammers and algebraic nails and so on.

Re:New in PostgreSQL 10 by noncoml on Thursday September 21, 2017 @04:46PM (#15307195)
In which case they would not be designing for the future.

Did you miss this: "(unless of course they are already starting with a huge amount of data)"?

Re:New in PostgreSQL 10 by gshulegaard on Thursday September 21, 2017 @04:33PM (#15307073)
This is a really insightful comment. It's not that you can't get Postgres to handle any volume...it's how much work is required on your part.
Re:New in PostgreSQL 10 by threeseed on Thursday September 21, 2017 @05:58PM (#15307706)
> Cassandra is an eventual consistent database.

No. Cassandra is a database with selectable consistency.

You can set it to be strongly consistent (ALL or QUORUM) with the tradeoff being worse performance.

Re:New in PostgreSQL 10 by SEJeff on Thursday September 21, 2017 @03:53PM (#15306784)
Define "big data"? You can buy normal tier 1 server vendor hardware with 6T of memory.

If it fits into 1 machine or a few, it isn't "big data".

Re:New in PostgreSQL 10 by imtringued on Thursday September 21, 2017 @04:50PM (#15307229)
To be honest 6 TB of data isn't that much. I'd say big data starts at around one petabyte because one petabyte requires 3 servers with 45 [1] 8TB hdds. At this point your data is so large it's impossible to store it on a single physical machine.

"big data" usually doesn't require transactions though or at least no transactions across servers so you could probably get away with sharding postgresql via citus.

[1] http://www.45drives.com/products/storage/

Re:New in PostgreSQL 10 by SEJeff on Thursday September 21, 2017 @06:21PM (#15307850)
I agree with this response. Those aren't very big either though. The Dell DSS7000 series servers[1] support 90 x 8TB drives (We run a ceph cluster on 4 of the DSS7500 storage nodes).

[1] http://www.storagereview.com/dell_announces_availability_of_...

Re:New in PostgreSQL 10 by Thaxll on Thursday September 21, 2017 @08:41PM (#15308527)
Except that it's just stupid to do that, you don't want to store that much data in one host, it goes against any sane architecture design, good luck when you're mb / cpu dies. Splitting data on smaller / cheap hosts is the way to go for ops / scaling / backups.
Re:New in PostgreSQL 10 by wiremine on Thursday September 21, 2017 @04:12PM (#15306938)
Maybe. I recently updated some of my company's internal training material, and discovered there still isn't a single (good) definition of "Big Data". Most definitions talk evaluating data on four dimensions: volume, variety, velocity and veracity. That's still a vague, but it's more helpful than looking at volume alone.

Besides, if we picked machine size as _the_ definition, it would change every year. And that feels like a bad way to talk about big data.

(BTW, I'm not a huge fan of the term in general: I've seen a lot of companies sold a bill of good because some sales guy convinced them they needed a Big Data solution instead of something like Postgres)

Re:New in PostgreSQL 10 by wjossey on Thursday September 21, 2017 @04:43PM (#15307163)
I've also struggled with the definition of Big Data. I typically see "size" as being the line of demarcation people throw around when thinking about Big Data, but I think it's it's actually size + latency that's the real definition.

If I have a 12TB dataset, and I need to be able to find a single record in that dataset, and return the results to a process in less than one second, I don't believe that needs to be considered "big data". The dataset is "large", but the latency / access pattern surrounding that data is low enough that you can solve that with a handful of hard drives and your data sorted on disk.

If I have a 12TB dataset and I need < 10ms latency on random lookups, that is now probably big data. To guarantee those sort of lookup times for random IO, I either need very expensive hardware, or a software based solution to distribute my data to multiple machines.

If I have 10GB of census data, and I need to run an analysis that shows what are the 100 most similar cities (non approximation) to Los Angeles in terms of demographic make up, and I need an answer in less than 1 second, that is also probably big data. The analysis is easily parallelized, but if done serially on a single machine is a "slow" process.

I realize this is a moderately unconventional way of approaching Big Data, but it's how I've started to structure some of my thinking and explanations around why it's not just size, but size + latency (which is inherently a question of what you're trying to do with the data).

Re:New in PostgreSQL 10 by pulam on Thursday September 21, 2017 @04:08PM (#15306901)
I've heard this 6TB number thrown around a bit recently, but no one can actually provide me with links to hardware I can buy - has anyone successfully setup a machine with this much ram who can post links to what they used?
Re:New in PostgreSQL 10 by okaram on Thursday September 21, 2017 @04:33PM (#15307069)
Don't know about hardware you can buy, but AWS will rent you a machine with 3TB Ram by the hour :) https://aws.amazon.com/ec2/instance-types/
Re:New in PostgreSQL 10 by runako on Thursday September 21, 2017 @04:42PM (#15307155)
Re:New in PostgreSQL 10 by qaq on Thursday September 21, 2017 @04:23PM (#15307004)
Re:New in PostgreSQL 10 by willtim on Thursday September 21, 2017 @04:01PM (#15306848)
And the postgres maximum table size is 32T.
Re:New in PostgreSQL 10 by Tostino on Thursday September 21, 2017 @04:07PM (#15306892)
You can partition your table if it got anywhere near that large (with the shiny native partitioning introduced in PostgreSQL 10).
Re:New in PostgreSQL 10 by qaq on Thursday September 21, 2017 @04:07PM (#15306897)
You really don't want to have the whole DB be much above 30TB. You'd either want to shard or use some alternative solution.
Re:New in PostgreSQL 10 by gshulegaard on Thursday September 21, 2017 @04:27PM (#15307021)
Ultimately it depends on your use case and how much tuning/schema design/explicit management you are willing to do.

My team lead did a talk at NGINX Conf 2017 which touched on how we tuned Postgres to handle 1 Billion metrics per day for NGINX Amplify (https://www.nginx.com/products/nginx-amplify/). I would link it, but it seems it hasn't been published by our Conf team yet.

We did this on 9.4 so the changes outlined here regarding native partitioning, parallel queries, replication improvements, etc. would likely make doing a similar scaling structure easier and just straight up more performant.

I wouldn't classify 1 Billion metrics a day as "Big Data". I also would point out that our use case is unfairly biased to "recent" data rather than "all historical" data...which allows us to make some query optimizations that wouldn't be acceptable in the latter use case.

But we are using Postgres to host a constant, write-heavy workload that conventional wisdom dictates it is unsuited for. Moreover, it was/is fairly simple to implement, understand, and scale indefinitely. Personally, I think both Redshift and CitusData are various degrees of proof that scaling Postgres to handle these types of workloads is possible.

For me, the reason you want to consider using a Big Data focused tool (such as Cassandra) is at some point you end up fighting your tool to make a square peg fit in a round hole. At some point it makes more sense to adopt a specialized tool rather than work to specialize your implementation of a specific tool.

In all fairness, we are considering just that. Our road map actually has Scylla in the near future. It's not that we don't think Postgres could handle the load, but rather we think it will be easier to move specific data to Scylla and in the long run will save us resources (primarily in man hours and potentially in compute requirements as well).

Even if we move all our timeseries data to a specialized tool, we won't be getting rid of Postgres. For most/if not all our other persistence requirements Postgres is more than adequate. This is one of the reasons we chose to start with Postgres: even once we hit a scale that specialized tools made sense, Postgres would still be useful for everything else that doesn't require a specialized tool.

Moral of the story: Postgres will get you a lot farther than many give it credit for...and if you are just starting out I would highly encourage you to just pick Postgres and see how far it can take you. If you hit the limit, replace that specific part.

Edit: Also, there appears to be some movement on Columnar indexes which is worth keeping an eye on:

https://blog.2ndquadrant.com/postgresql-10-roadmap/

Re:New in PostgreSQL 10 by spullara on Thursday September 21, 2017 @06:01PM (#15307731)
CitusData yes but RedShift is the Paraccel backend and just uses the frontend of postgresql.
Re:New in PostgreSQL 10 by gshulegaard on Monday September 25, 2017 @01:54PM (#15332499)
Hmmm...I thought ParAccel was a derivative of Postgres:

https://wiki.postgresql.org/wiki/PostgreSQL_derived_database...

Re:New in PostgreSQL 10 by snissn on Thursday September 21, 2017 @04:07PM (#15306890)
Does Cassandra allow aggregate functions like sum() or avg() yet?
Re:New in PostgreSQL 10 by super_mario on Thursday September 21, 2017 @04:35PM (#15307085)
Yes in newest versions it does. But for any non-trivial analytics you would use Apache Spark (most likely Spark/SQL).

Cassandra's CQL is very limited in terms of types of queries it supports.

Re:New in PostgreSQL 10 by Chickenosaurus on Thursday September 21, 2017 @04:30PM (#15307052)
Yes, Cassandra supports common aggregation functions as well as user-defined aggregators which have to be created in Java.
Re:New in PostgreSQL 10 by Chickenosaurus on Thursday September 21, 2017 @03:53PM (#15306786)
I am interested in the answer to this question, too.