News for hackers. Stuff that matters.
Re:RethinkDB versus PostgreSQL: my personal experience by koolba on Thursday February 09, 2017 @03:44PM (#13610778)
> Carefully-tuned RDBMSs are more capable than many tend to admit.

I'd generalize that further: RDBMSs are more capable than many tend to admit.

When it comes to a persistent data store, you've got to go out of your way to justify using something that isn't statically typed with firm ACID guarantees. I'm not saying those use cases don't exist, I'm saying most people don't have them.

"Saving" 15 minutes of dev time because you don't know what your schema is going to look like is going to cost you orders of magnitude more time down the road asking yourself that same question.

Re:RethinkDB versus PostgreSQL: my personal experience by stouset on Thursday February 09, 2017 @06:12PM (#13611914)
> "Saving" 15 minutes of dev time because you don't know what your schema is going to look like is going to cost you orders of magnitude more time down the road asking yourself that same question.

Yeah. In my experience, "schemaless" doesn't mean you have no schema. You still have a schema, it's just implicit and you don't have any tools available to actually operate on that schema.

Re:RethinkDB versus PostgreSQL: my personal experience by smallnamespace on Thursday February 09, 2017 @06:27PM (#13612023)
This is pretty similar to the argument for static typing. Better to let the type system (help) prove correctness ahead of time, rather than wait until runtime to debug.
Re:RethinkDB versus PostgreSQL: my personal experience by hashkb on Thursday February 09, 2017 @09:54PM (#13612906)
It's generally easier to fix an incorrect program than corrupt data.

You're not wrong, but the magnitude doesn't compare.

Re:RethinkDB versus PostgreSQL: my personal experience by adw on Thursday February 09, 2017 @11:43PM (#13613277)
Yep. Everyone winds up with some war story about cleansing some multi-petabyte data store – but the better data engineers I know try very hard to avoid having two of them.
Re:RethinkDB versus PostgreSQL: my personal experience by stouset on Friday February 10, 2017 @12:10AM (#13613372)
Yeah. I'm a huge fan of dynamically (yet strongly) typed languages like Ruby. They absolutely have their place. But weakly-typed data persistence or data interchange are absolutely terrible.
Re:RethinkDB versus PostgreSQL: my personal experience by krylon on Friday February 10, 2017 @06:08AM (#13614571)
It's not just about type safety, though. A good RDBMS enforce things like referential integrity (FOREIGN KEY constraints) and allow you to express further constraints on your data (e.g. order.amount must be a positive number, a certain combination of columns must be unique across the table, etc.)

And most (all?) RDBMS that have been around for a while have been tuned and optimized to support this efficiently. I remember reading that at some point (1980s-1990s-ish) DBMS vendors were buying compiler developers like crazy to help them with query optimization and such.

Re:RethinkDB versus PostgreSQL: my personal experience by digitalzombie on Friday February 10, 2017 @01:53AM (#13613711)
Seriously, eventually the data have to be structure some how so you can make use of it.

Hence you end up writing map reduce down the road.

Mind as well do it upfront with Relational DB.

Re:RethinkDB versus PostgreSQL: my personal experience by threeseed on Thursday February 09, 2017 @06:48PM (#13612115)
In almost all cases I've seen the schema is simply in the application layer as opposed to the database layer.

The argument for schemas within databases was when you had dozens of users and applications all connected to a database. In the last few years we've seen micro services, Kafka queues and REST APIs replace the database as the primary integration points.

Re:RethinkDB versus PostgreSQL: my personal experience by 67726e on Thursday February 09, 2017 @11:38PM (#13613259)
Your schema might sit in code, but you've got to reinvent the wheel on all sorts of validations and guarantees your database would provide. Whether you have queues and APIs is irrelevant, your persistent store should be a strong one.
Re:RethinkDB versus PostgreSQL: my personal experience by throwaway91111 on Thursday February 09, 2017 @08:05PM (#13612506)
What sort of tooling does rethinkdb have for verifying the schema of existing data and inserts?
Re:RethinkDB versus PostgreSQL: my personal experience by SamReidHughes on Friday February 10, 2017 @01:57PM (#13617895)
Soon, write hooks. Not the greatest solution though.
Re:RethinkDB versus PostgreSQL: my personal experience by pryelluw on Friday February 10, 2017 @02:18AM (#13613787)
Worse is when the schema is written into the code. It turns tje codebase into a horrible mess.
Re:RethinkDB versus PostgreSQL: my personal experience by scaryclam on Friday February 10, 2017 @08:17AM (#13615137)
I'd probably change this a bit by saying that it's not a problem to have the schema in the code (it's got to be somewhere, preferably version controlled), it's a problem when your schema reflects (or even worse, is) your business logic.

edit: s/you're/your/

Re:RethinkDB versus PostgreSQL: my personal experience by pryelluw on Saturday February 11, 2017 @02:27PM (#13624254)
Yes, exactly.
Re:RethinkDB versus PostgreSQL: my personal experience by virtuabhi on Thursday February 09, 2017 @07:01PM (#13612185)
Schemaless design enables the organizations to collect data now and decide what to do later. Though analysts who work on these datasets should be able to write code to parse the records when needed.
Re:RethinkDB versus PostgreSQL: my personal experience by naasking on Friday February 10, 2017 @12:50AM (#13613516)
> Though analysts who work on these datasets should be able to write code to parse the records when needed.

Right, so the data conforms to a known schema that they can program against. Schemaless design doesn't somehow make this possible, it actually makes it difficult. If you already know what data you're capturing, then you have a schema.

Re:RethinkDB versus PostgreSQL: my personal experience by scaryclam on Friday February 10, 2017 @08:26AM (#13615180)
This seems to be a growing issue in the industry as we go more and more data driven.

I don't think most devs seem to realise that just throwing data into a data store, without constraints, integrity checks of any of that other boring stuff, actually makes the data useless.

Try doing analytics against data that can be anything. You can't. Mixing numbers with strings, duplicating fields or having them under varying naming strategies, all just mean you have lots of data that you cannot use.

One of the pet peeves I see data scientists having is lots of data, with no organisation, as they can't use it.

If you want to collect data now that's fine. Collect it in it's original format and label what that format is and where it came from. Then make a proper data store with a proper schema and work on importing the data from those sourcs when you have this foundation sorted out.

Re:RethinkDB versus PostgreSQL: my personal experience by digitalzombie on Friday February 10, 2017 @01:56AM (#13613722)
Schemaless imo is just kicking the can down the road.

You always know what kind of data it is anyway. You don't just dump random data, at least not the majority of the time. When you grab data you're grabbing a specific data group.

Re:RethinkDB versus PostgreSQL: my personal experience by hvidgaard on Friday February 10, 2017 @02:47AM (#13613884)
It's important to keep in mind that the "collect now and analyze later" is exactly that. You don't have to worry about constraints and integrity, you just capture what you think is of value, which is likely to be all the things unless you're working at really large scales. For all intents and purposes, storing everything as text files is just as good for this task.
Re:RethinkDB versus PostgreSQL: my personal experience by naasking on Friday February 10, 2017 @10:00AM (#13615783)
> You don't have to worry about constraints and integrity

Sure, you don't have to specify or enforce constraints with a schema either. A schema just means the data has a well-defined structure, it doesn't mean you have to enforce constraints of any kind, though that often helps a lot. Data with no structure at all is very likely useless.

Re:RethinkDB versus PostgreSQL: my personal experience by fnord123 on Friday February 10, 2017 @09:01AM (#13615367)
It's not always straight forward. A lot of protocols use delta encoding. For example "insert BUY GBPUSD, price=1.1702, volume=100000". But yes, it's worth coming up with a schema on write if at all possible.
Re:RethinkDB versus PostgreSQL: my personal experience by naasking on Friday February 10, 2017 @10:04AM (#13615816)
But then you can't query schemaless data without sophisticated parsing or absurd wildcard/regex matching of some sort, which obviously is highly error-prone, thus making schemaless data at best only probabilistically useful.

For delta-encoded models, it still seems straightforward to define a general schema via (operation, objectId, value, transactionId) tuples. 'value' can be a string if you want maximum flexibility, but at least this way you can reliably query the operations, entities involved and which changes happened together as a group.

Re:RethinkDB versus PostgreSQL: my personal experience by fnord123 on Friday February 10, 2017 @11:20AM (#13616458)
>But then [it sucks]

Absolutely. I agree with you, I'm just saying it's not trivial to turn a delta encoded format into a nice schema.

I mean, I would advise against storing deltas as tuples and considering that the schema. If it's at all possible, try to rectangularize your format. If you're using a column store a lot of the redundant data from the denormalisation can be compressed away.

If the rectangularisation is lossy then you may need to archive the raw data. This is the hurdle where a lot of people stop and choose schema-on-read since they can't afford the storage requirements for an archive of raw data and a nice analytic format for querying.

Re:RethinkDB versus PostgreSQL: my personal experience by 9gunpi on Friday February 10, 2017 @03:04AM (#13613930)
Offsetting database layout decisions is not having better flexibility, it is having less clue about database layout, unfortunately.

Collecting data in some form and re/de-normalizing it in some useful fashion isn't exactly huge problem if you're not NetFlix or Google (and isn't huge problem even then).

It just requires certain amount of education.

Re:RethinkDB versus PostgreSQL: my personal experience by mickronome on Thursday February 09, 2017 @07:10PM (#13612237)
The problem with standard'ish SQL+RDBMS and their schemas is that types are not enforced well in SQL and most libraries and language integrations, thus we end up with the quagmire of static schemas that can not be reliably type checked when you use standard tooling.

Also lacking in many DB systems is integrated support for tables withh heterogenous schemas that is supported by page/row-level cersioning and/or on line schema alteration. Having to rewrite a huge table only because you want to narrow a couple field for future data, it gets old quickly.

Re:RethinkDB versus PostgreSQL: my personal experience by ankrgyl on Thursday February 09, 2017 @07:28PM (#13612324)
> The problem with standard'ish SQL+RDBMS and their schemas is that types are not enforced well in SQL and most libraries and language integrations, thus we end up with the quagmire of static schemas that can not be reliably type checked when you use standard tooling.

This used to be an issue with MySQL (and not really any other major RDBMS implementation), but with STRICT_MODE and the default settings on other implementations, SQL is fantastic at representing and enforcing static types. Furthermore, ORMs and tools like Apache Spark have really upped the integration between types in the database and types in languages. Practically speaking, RDBMS is really the only way you can have sane static typing in most applications (esp. ones that are built on dynamic languages).

> Also lacking in many DB systems is integrated support for tables withh heterogenous schemas that is supported by page/row-level cersioning and/or on line schema alteration. Having to rewrite a huge table only because you want to narrow a couple field for future data, it gets old quickly.

This is just not true. All of the major commercial RDBMS systems support both online schema alteration AND flexible/semi-structured types (JSON, XML). Again, MySQL and Postgres are behind the curve on this (although they both now support JSON). Commercial systems like SQL Server, Oracle, and MemSQL all have both.

Re:RethinkDB versus PostgreSQL: my personal experience by philliphaydon on Thursday February 09, 2017 @08:40PM (#13612623)
I'm not sure if I read your comment properly. But you said SQL Server has both? Both JSON and XML?

Yes SQL Server has json, but it's not real json support. It's an ntext column with some json functions... support for XML is great but the sql Server team refuses to support json properly because "we invested in xml and no one uses it"

PostgreSQL on the other hand has a real json type for a Long time with query and index support. As well as xml. In this regard, json support. PostgreSQL is actually ahead of all rdbms...

Re:RethinkDB versus PostgreSQL: my personal experience by jeltz on Thursday February 09, 2017 @10:54PM (#13613090)
PostgreSQL may be behind in some other areas but not here. PostgreSQL has some of the best support for online schema changes (transactional DDL for almost everything, lots of work put into reducing lock level of schema changes) and was the first to implement support for JSON.
Re:RethinkDB versus PostgreSQL: my personal experience by williamstein on Friday February 10, 2017 @02:26AM (#13613813)
When doing the rewrite, I was extremely surprised by how good PostgreSQL's JSON support is; there are a large number of functions for querying nested structures, and the indexing is very powerful. I mapped my data from RethinkDB documents to mostly relational data, but kept a couple of columns as JSONB for now, which saved time and massively simplified the rewrite. I remember trying to fully model similar data back in 2007, and it got overly complicated for no real benefit...

(I'm the author of the blog post.)

Re:RethinkDB versus PostgreSQL: my personal experience by rixed on Thursday February 09, 2017 @11:32PM (#13613240)
Please try to alter a schema of a live multibillion rows table before pretending that it works. Unless they changed how is implemented recently then such an operation can take hours. I love postgres for many reasons so i would like to be proven wrong.
Re:RethinkDB versus PostgreSQL: my personal experience by luhn on Friday February 10, 2017 @12:44AM (#13613492)
Some schema changes can take prohibitively long on large tables, so you do have to be careful. But there are ways of achieving the same results that are safe for production database. Braintree did a decent writeup on it. https://www.braintreepayments.com/blog/safe-operations-for-h...
Re:RethinkDB versus PostgreSQL: my personal experience by jeltz on Friday February 10, 2017 @08:29AM (#13615194)
I have never worked with a database of that size but I have done major refactoring of tables with about half a billion rows. And while it can take hours for the schema changes to finish it is hours without any downtime (or just a couple of seconds of downtime during when the exclusive locks need to be acquired). It is tedious to have to wait that long (especially if one has 10 times the rows than what we did), but PostgreSQL can do almost any change online just fine.

What kind of schema changes do you think of that would require that much downtime? Even in complex cases that can be avoided with triggers or even rules.

Re:RethinkDB versus PostgreSQL: my personal experience by grzm on Thursday February 09, 2017 @11:39PM (#13613260)
Depends on the schema change. If you have a multibillion row table there are plenty of other things you need to pay close attention to as well, as you're probably all-too aware.
Re:RethinkDB versus PostgreSQL: my personal experience by unixhero on Friday February 10, 2017 @02:04AM (#13613747)
Hours is okay, if it works.
Re:RethinkDB versus PostgreSQL: my personal experience by sgift on Friday February 10, 2017 @02:30AM (#13613828)
Now, if you could just tell this to the people who depend on the software and tell me that hours of down time is not a possibility.
Re:RethinkDB versus PostgreSQL: my personal experience by MarHoff on Friday February 10, 2017 @03:37AM (#13614057)
Hours of work <> Hours of downtime

The bigger the database the more complex it will be to implement schema change while keeping track of transactions that happen while your are transitioning. However I see no reason why it shouldn't be feasible given proper amount of preparation. And if short downtime is a goal I don't see why a proper amount of time developing a solution wouldn't make it either.

And on top of that PostgreSQL community is implementing new way to solve problem with each release. I'm not in a huge live-data use case so I might be wrong, but upcoming logical replication look promising for such use cases https://www.depesz.com/2017/02/07/waiting-for-postgresql-10-....

Re:RethinkDB versus PostgreSQL: my personal experience by vog on Friday February 10, 2017 @04:51AM (#13614339)
> online schema alteration AND flexible/semi-structured types (JSON, XML).

> Again, MySQL and Postgres are behind the curve on this

You may want to remove PostgreSQL from that list, especially in 2017.

PostgreSQL has supported XML for years (long before it supported JSON). And online schema changes are not only possible, but even transaction safe, which is especially nice for migrations.

Re:RethinkDB versus PostgreSQL: my personal experience by jimktrains2 on Thursday February 09, 2017 @07:27PM (#13612321)
> types are not enforced well in SQL

I'm not sure what you mean. Sane RDBMS do enforce types strictly.

> language integrations, thus we end up with the quagmire of static schemas that can not be reliably type checked when you use standard tooling

Languages that don't have static types to begin with maybe. > tables withh heterogenous schemas that is supported by page/row-level cersioning

Can you give an example of what you mean?

> on line schema alteration.

> Having to rewrite a huge table only because you want to narrow a couple field for future data, it gets old quickly.

Postgres doesn't need to lock the whole table for many types of alterations. It won't rewrite the table for null default fields.

Re:RethinkDB versus PostgreSQL: my personal experience by bfrog on Thursday February 09, 2017 @07:27PM (#13612318)
I've never had such issues with postgres personally. I know mysql is awful for schema migrations.
Re:RethinkDB versus PostgreSQL: my personal experience by StreamBright on Sunday February 12, 2017 @03:24AM (#13627424)
This problem was definitely there for certain SQL servers when inserting incorrect values causes the server the silently cast the data to the field definition type. MySQL had something similar 10 years ago. I think in 2017 most of the SQL servers handle types properly. Adding support for more advanced types like UUID or custom types is a great thing and I see the use of it in production every day.

I dont really see the case for heterogenous schemas, I usually create a view of two very similar tables by creating a union with null fields. This works well enough.

Re:RethinkDB versus PostgreSQL: my personal experience by aidos on Thursday February 09, 2017 @04:25PM (#13611138)
After a long time with RDBMSs I used nosql at one point for my product in anger and I found the work to keep the data consistent just too stressful.

I'm happy to be back on Postgres again (and have been for a couple of years). It protects me from my own human inadequacies.

Re:RethinkDB versus PostgreSQL: my personal experience by sgift on Friday February 10, 2017 @02:34AM (#13613838)
RDBMs may not scale as well as let's say something like Cassandra, but as long as you don't need the scaling properties of Cassandra they make your life so much easier.

I have a feeling that premature scaling is a version of premature optimization. You probably don't have big data. And you probably don't need a massively scalable, distributed system. So, don't try to do it. Just don't.

Re:RethinkDB versus PostgreSQL: my personal experience by wallstprog on Thursday February 09, 2017 @04:58PM (#13611405)
"Those who refuse to study history are condemned to repeat it"

People like Jim Gray, Mike Stonebraker, et al. were/are not dummies.

Re:RethinkDB versus PostgreSQL: my personal experience by Entangled on Thursday February 09, 2017 @05:07PM (#13611472)
"Those who ignore Codd are condemned to learn Codd, forcefully".- Codd's Law

Adapted to DBs.

Re:RethinkDB versus PostgreSQL: my personal experience by hvidgaard on Friday February 10, 2017 @02:49AM (#13613893)
The simple fact that I know the data I read from the datastore is consistent with my rules, is enough for me to stay on RDBMS. I've encountered enough bugs and failures to not trust a schema enforced in my data layer code.
Re:RethinkDB versus PostgreSQL: my personal experience by threeseed on Thursday February 09, 2017 @06:55PM (#13612156)
Posts like this are annoying and completely stupid.

NoSQL databases encapsulates a wide variety of data stores including Key Value (Riak), BigTable (Cassandra), Document (MongoDB), Time Series (InfluxDB), In Memory Grid (Ignite) and dozens and dozens of others that blur the already grey lines. Many of which are strongly consistent (negating your consistency point). So your experience with one does not at all translate to other data stores.

The equivalent of what you're saying is "PHP sucks therefore all programming languages suck".

Re:RethinkDB versus PostgreSQL: my personal experience by elliotf on Thursday February 09, 2017 @10:09PM (#13612961)
I think the point of the post is valid: it can be hard to work with a schemaless datastore. I think Cassandra is the only one you listed that supports type enforcements.
Re:RethinkDB versus PostgreSQL: my personal experience by threeseed on Thursday February 09, 2017 @10:58PM (#13613105)
NoSQL != Schemaless.

That mantra hasn't been true for a number of years now. Especially since the big trend has been exposing SQL layers in front of NoSQL databases. For example Phoenix in front of HBase.

And SQL as well as all know requires data types to be usable.

Re:RethinkDB versus PostgreSQL: my personal experience by aidos on Saturday February 11, 2017 @11:04AM (#13623149)
Just to explain - I was going to write mongo originally but then decided to go more general. I evidentially went too general with my terminology. I've used mongo since the early days and I've also worked on projects that have used everything from neo4j and redis to oracle as the primary data store.

There are a bunch of things that made me nervous about mongo as the primary db. Data consistency was the main one and, like the author of the post - migrating away from mongo was hard almost entirely because of data inconsistency that had developed over the course of a couple of years.

Querying was also harder on an ad-hoc basis. With a relational db there are generally just a couple of recommended ways of modelling your data. But once you do that, it's easy to query after the fact. Or to add new stuff. With mongo I felt like I was constantly making a trade off that I would have to accept at querying time.

Re:RethinkDB versus PostgreSQL: my personal experience by squeaky-clean on Friday February 10, 2017 @12:05AM (#13613353)
MongoDB has been able to do this (optionally) since v3.2.
Re:RethinkDB versus PostgreSQL: my personal experience by 35bge57dtjku on Friday February 10, 2017 @01:01AM (#13613558)
Isn't it more like saying all loosely typed languages suck? Your analogy is what's really completely stupid.
Re:RethinkDB versus PostgreSQL: my personal experience by adw on Thursday February 09, 2017 @11:40PM (#13613262)
I'd agree entirely. Unless you have an exceptional reason, in which case you probably know what you're doing already, build a version of your system which uses either a relational database (with a sensible schema, not a single-table EAV thing) or a filesystem as a backing store first.

(When it comes to a primary data store, its first job is integrity, so denormalization is premature optimization.)

Similarly; don't distribute any computation you don't have to distribute. Just getting a bigger machine is remarkably likely to be cheaper, more operable and more reliable.

Re:RethinkDB versus PostgreSQL: my personal experience by throwawayish on Friday February 10, 2017 @03:40AM (#13614069)
> ... or a filesystem as a backing store first.

File systems are far harder to use correctly compared to pretty much any database; suggestion: only use them for storing large blobs, and use collision-free names (eg. random UUIDv4). Many applications don't need that though.

Re:RethinkDB versus PostgreSQL: my personal experience by adw on Friday February 10, 2017 @11:30PM (#13621021)
Sometimes you just have large blobs, though! (I'm thinking, for instance, of machine-learned models; big matrices are exactly the kind of thing we have HDF5 and friends for.)
Re:RethinkDB versus PostgreSQL: my personal experience by quizotic on Thursday February 09, 2017 @04:49PM (#13611336)
> "Saving" 15 minutes of dev time because you don't know what your schema is going to look like is going to cost you orders of magnitude more time.

While I agree with the spirit of this, sometimes you'll never know what your schema is, because it's not under your control to begin with. That's why there are triple-stores and "document" databases and key-value stores now, and why there were deductive databases 30 years ago.

The world is wide, and there's room for more than one tool in the chest.

Re:RethinkDB versus PostgreSQL: my personal experience by benjiweber on Thursday February 09, 2017 @06:06PM (#13611878)
Postgres is of course an excellent document store with JSONB.

Its really powerful being able to create relational views backed onto data as json and vice versa.

Re:RethinkDB versus PostgreSQL: my personal experience by cageface on Thursday February 09, 2017 @09:27PM (#13612822)
Exactly. The arrival of JSONB in Postgres killed most of my interest in other nosql stores. It's the best of both worlds.
Re:RethinkDB versus PostgreSQL: my personal experience by rodionos on Friday February 10, 2017 @02:48AM (#13613886)
This assumes that JSON is what you want to store and query. In my experience, about 1 year ago, I couldn't get basic things out from the Puppet database.
Re:RethinkDB versus PostgreSQL: my personal experience by Bedon292 on Thursday February 09, 2017 @06:06PM (#13611883)
Even those use cases can sometimes be met by an RDBMS. Postgres can outperform Mongo as a key value, or json doc store. But Mongo is what many people think of for something like that.
Re:RethinkDB versus PostgreSQL: my personal experience by quizotic on Thursday February 09, 2017 @06:35PM (#13612056)
And for those who may not know, but appreciate irony, Mongo now uses ... wait for it ... a somewhat stripped down, key-value-ish, embedded ... RDBMS as its underlying data store. Yes friends, "it's a dessert topping AND a floor wax"
Re:RethinkDB versus PostgreSQL: my personal experience by quizotic on Thursday February 09, 2017 @06:39PM (#13612074)
should also point out that Mongo is more than a jsonb store, and postgres is, at least currently, less than a distributed, "scale-out" database. Mongo supports problems that postgres cannot currently address. period. (and I'm a huge postgres fanboi)
Re:RethinkDB versus PostgreSQL: my personal experience by philliphaydon on Thursday February 09, 2017 @10:29PM (#13613012)
Could you share some of those problems? (genuinely interested)
Re:RethinkDB versus PostgreSQL: my personal experience by phamilton on Friday February 10, 2017 @10:32AM (#13616028)
Horizontal scalability. Outgrowing a single master database (writes being bottlenecked, not reads) is really painful. You can engineer around it, but spinning up another master in a multimaster DB is a really quick and easy fix (once you have tooling built out it's a matter of minutes). Sharding your Postgres DB is not a quick and easy fix. It will likely take about a month to engineer around and perform the data migration, if not longer.
Re:RethinkDB versus PostgreSQL: my personal experience by floatboth on Friday February 10, 2017 @01:12PM (#13617512)
I've heard good things about Citus for horizontally scaling Postgres.
Re:RethinkDB versus PostgreSQL: my personal experience by phamilton on Friday February 10, 2017 @05:01PM (#13619291)
I've pretty much only heard about it in the context of OLAP. If your data model requires transactions, you're gonna have a hard time when you outgrow a database.
Re:RethinkDB versus PostgreSQL: my personal experience by threeseed on Thursday February 09, 2017 @06:58PM (#13612168)
PostgreSQL outperforms MongoDB how ?

Because as someone who has tried to update JSON documents (1M/s) in both PostgreSQL and MongoDB I would strongly disagree. MongoDB with WiredTiger was at least 10x faster per node and in terms of pure updates one of the fastest databases I've ever seen. And before the trolls yes I was fsyncing to disk.

Re:RethinkDB versus PostgreSQL: my personal experience by drdaeman on Thursday February 09, 2017 @09:56PM (#13612915)
Postgres doesn't fancy many small and frequent updates (like rapid counter increments).

It is workable, though, via combination of batching, ensuyring indexes on hot fields have appropriate fillfactor, and making sure Postgres can use heap-only tuples.

Here's my old SO question on this and a well-comprehensive answer that's still actual and could be helpful for some cases: http://stackoverflow.com/a/1663434/116546

Re:RethinkDB versus PostgreSQL: my personal experience by StreamBright on Friday February 10, 2017 @03:52AM (#13614131)
This is pretty amazing. Now, would you mind showing me a situation when the raw insert performance is the single dimension when we are making a technical decision?

Hint: you probably can't, the reason why you store data is that you can read it (query it) later. MongoDB could be 10000x faster with inserts, still not a considerable solution for us because it fails with many of the other aspect of providing a great data access layer.

Re:RethinkDB versus PostgreSQL: my personal experience by osullivj on Friday February 10, 2017 @05:34AM (#13614472)
Raw insert performance is the main driver for tick databases persisting high frequency market data for HFT systems. The TimesTen DB, later bought by Oracle, was built for this scenario. Arthur Whitney's KDB too.
Re:RethinkDB versus PostgreSQL: my personal experience by StreamBright on Friday February 10, 2017 @01:27PM (#13617639)
Not to mention the sub second latecy for querying 1B rows.
Re:RethinkDB versus PostgreSQL: my personal experience by pmelendez on Friday February 10, 2017 @05:45AM (#13614511)
Not the single dimension but an important one. Any real time application processing events data (IoT, heartbeats, prices logs) would have a similar requirement. That's one reason why people uses queues, to try to workaround this. And as for the reads, it will drilldown to your query needs. I have done systems where the read requirement was a retrieval from a key and the writes request came in thousands per second.
Re:RethinkDB versus PostgreSQL: my personal experience by StreamBright on Friday February 10, 2017 @01:33PM (#13617701)
Absolutely, I have run data ingestion pipelines before for event data processing, perfectly suitable for the use cases you mentioned too. I just dont see mongodb as a good fit here.
Re:RethinkDB versus PostgreSQL: my personal experience by jeltz on Thursday February 09, 2017 @11:02PM (#13613119)
I think it depends on the workload. PostgreSQL does not not support updating documents in place but is really fast at writing and reading. Never done any benchmarking myself, this is just based on my general knowledge of what data structures and algorithms both databases implement.
Re:RethinkDB versus PostgreSQL: my personal experience by zapov on Thursday February 09, 2017 @10:11PM (#13612967)
Re:RethinkDB versus PostgreSQL: my personal experience by threeseed on Thursday February 09, 2017 @10:59PM (#13613108)
Not worth much. MongoDB is a completely different beast after version 3.0 with WiredTiger being the default.

But I am sure that there are use cases for which PostgreSQL is going to be much faster in particular single field lookups on unindexed fields across all records.

My point is that it's never black & white to say Database A is faster than Database B. It's always use case dependent.

Re:RethinkDB versus PostgreSQL: my personal experience by zapov on Thursday February 09, 2017 @11:34PM (#13613252)
well there is also https://www.techempower.com/benchmarks/#section=data-r13&hw=...

Point being when someone says something is faster without providing verifiable numbers... it should not really be taken seriously

Re:RethinkDB versus PostgreSQL: my personal experience by tokenizerrr on Thursday February 09, 2017 @05:59PM (#13611843)
> I'm not saying those use cases don't exist, I'm saying most people don't have them.
Re:RethinkDB versus PostgreSQL: my personal experience by chopin on Friday February 10, 2017 @02:28AM (#13613822)
Though I agree with you there is the problem that RDBMSs can't handle hierarchical data very well. This comes up in enterprise master data quite often, eg. in employee relationships or organizational structures. I'm no SQL wiz but I have yet to see a readable and well-performing SQL which can select the managerial line of an employee.
Re:RethinkDB versus PostgreSQL: my personal experience by pg314 on Friday February 10, 2017 @03:27AM (#13614002)
A PostgreSQL (recursive) WITH query [1] can deal with that:

  CREATE TABLE employee (
         id int primary key,
         name text,
         manager int references employee(id)
  );

  INSERT INTO employee(id, name, manager)
  VALUES (1, 'jane', null),
         (2, 'john', 1),
         (3, 'jake', 1),
         (4, 'jeff', null),
         (5, 'jessica', 3);

  WITH RECURSIVE t(manager, managed) AS (
       -- Direct managers
       SELECT manager, id
       FROM employee
       WHERE manager IS NOT NULL
       UNION ALL
       -- Indirect managers
       SELECT employee.manager, t.managed
       FROM t, employee
       WHERE t.manager = employee.id
         AND employee.manager IS NOT NULL)
  SELECT
          (SELECT name FROM employee WHERE id = t.managed),
          array_agg(employee.name) AS chain_of_command
  FROM t, employee
  WHERE t.manager = employee.id
  GROUP BY managed;
Results of the query:

    name   | chain_of_command
  ---------+------------------
   jessica | {jake,jane}
   jake    | {jane}
   john    | {jane}
  (3 rows)
You can argue about the readability (syntax highlighting would help), but to my eyes it isn't that bad (if you know how WITH queries work). It's also more concise than the corresponding query would be in many a procedural language.

The efficiency should be pretty acceptable too (instead of having direct pointers O(1) to follow the manager, you follow them indirectly through an index O(log N)).

[1] https://www.postgresql.org/docs/9.6/static/queries-with.html

Re:RethinkDB versus PostgreSQL: my personal experience by hvidgaard on Friday February 10, 2017 @02:57AM (#13613915)
> I have yet to see a readable and well-performing SQL which can select the managerial line of an employee.

This is not a simple problem - I'm not even sure how to map it mathematically to set theory. SQL is based on set theory, and does so very well. What you describe is a graph problem, which simply falls outside of what SQL was designed for. Either a RDBMS needs to be extented to handle data in graph form and operate on them acording to graph theory, or you should use a DB suited for this problem.

Re:RethinkDB versus PostgreSQL: my personal experience by chopin on Friday February 10, 2017 @03:18AM (#13613980)
Point is, ideally you want both. Especially master data is closely entangled with data which you have in tables (and rightly so). In the example above consider an order header table which will have a reference to an employee (the one working on the order or the one who created the order). The schema for orders is rightly relational but I'd need a join to the employee which therefore is stored in a relational table as well.
Re:RethinkDB versus PostgreSQL: my personal experience by hvidgaard on Friday February 10, 2017 @03:32AM (#13614028)
I don't see how that scenario is anything but relational, even for queries, or are you talking in extension of the previous post about the managerial line? If so I agree, but instead of "poluting" the RDBMS with graph related constructs, I think the option here would be save the data in the RDBMS, and either build a graph on demand, or maintain an in memory graph, for queries. "Everything but the kitchen sink" are rarely a good idea for tools, it has a tendency to make the cost of switching some module unacceptable.
Re:RethinkDB versus PostgreSQL: my personal experience by guiriduro on Friday February 10, 2017 @04:41AM (#13614305)
Re:RethinkDB versus PostgreSQL: my personal experience by arkh on Friday February 10, 2017 @03:33AM (#13614032)
Recursive CTE can be used for this kind of queries. Or you can use nested sets / intervals depending on your workload and the tradeoffs you're ready to make.
Re:RethinkDB versus PostgreSQL: my personal experience by bluejekyll on Thursday February 09, 2017 @08:42PM (#13612638)
Also, Postgres Devs reignited the benefit of "schemaless" dbs, which supports JSON as a first class deeply queriable type.
Re:RethinkDB versus PostgreSQL: my personal experience by _Codemonkeyism on Friday February 10, 2017 @01:38AM (#13613675)
I think it's important to distinguish two cases. If mainly one app is the storage client, then you usually have the schema in the app, no problem with schemaless (most early phase startups).

If you have many different server apps accessing the database, then everyone has a different view on the schema which leads to high coordination overhead.

Re:RethinkDB versus PostgreSQL: my personal experience by shard972 on Friday February 10, 2017 @01:38AM (#13613676)
I will say this can go the other way in the hands of someone who doesn't understand what they are doing.

I recently started work at a startup where the codebase is running PHP/MYSQL which in itself is ok, but the database was horribly designed.

To deal with the tracking of "events" they constantly receive from devices that vary a lot from device to device it uses a linker table for every field that can be stored aside from ID. Considering the data never changes once inserted, it's really seems like overkill.

Any meaningful query that goes beyond getting a single datapoint involves dozens of joins which just kills the database. If someone just made him use mongo for the events storage we would probably be in a better position to fix the issues we are dealing with.

Re:RethinkDB versus PostgreSQL: my personal experience by jsmeaton on Friday February 10, 2017 @04:28AM (#13614251)
Postgres hstore fills the key value gap quite well too.
Re:RethinkDB versus PostgreSQL: my personal experience by lacampbell on Thursday February 09, 2017 @06:44PM (#13612101)
But there are document databases that have schemas, like couchDB.

So then it boils down to the cap theorem, and ease of ad-hoc querying vs ease of replication/scaling out. Which is more interesting.

Or do people try and push "not being able to validate your data" as some kind of feature?

Re:RethinkDB versus PostgreSQL: my personal experience by charrondev on Friday February 10, 2017 @02:17AM (#13613786)
I've been using couchdb to sync local and remote copies of a single database for a medium sized product and it is really convenient for that use case.