Live data from Hacker News

PostgreSQL as Schemaless Database [pdf]

wiki.postgresql.org

31–40 of 90 posts

Re: PostgreSQL as Schemaless Database [pdf]

#32
post #2

When the benchmark shows postgres can do the same as mongo, only faster, then why aren't we seeing more hybrid solutions? Online retailers would be better off using relational storage for monetary transactions and time series, and json storage for document like data.

The great thing about PostgreSQL is that it is hybrid.

With http://www.postgresql.org/docs/9.1/static/hstore.html you can put schemaless documents into the same database, even into the same table row as your usual relational data.

You could start with a schema that's only a primary key and hstore for all other data (like a fully schemaless database), but over time extract important fields from the hstore into columns to add indexes, constraints or joins.

Re: PostgreSQL as Schemaless Database [pdf]

#34
post #8

I want to admit that conclusion in presentation can be interpreted vise versa: MongoDB almost is fast as PostgreSQL. Also, notice that comparsion was done with Mongo 2.2, in 2.4 JS engine was changed to V8, so there is a lot of speed improvements. And compare PG have 18 years of development vs 5 of MongoDB. So what I want to say? Difference is not so big after all.

>I want to admit that conclusion in presentation can be interpreted vise versa: MongoDB almost is fast as PostgreSQL.

Which given how little MongoDB does, and how it can lose data unless you cripple the performance even more (ie. with waiting for successful write status), is impressive in itself.

>Also, notice that comparsion was done with Mongo 2.2, in 2.4 JS engine was changed to V8, so there is a lot of speed improvements.

Not really. The JS engine was never the bottleneck in MongoDB. The demanding stuff is done in the C/C++ core.

>And compare PG have 18 years of development vs 5 of MongoDB.

Not really relevant. PG had 18 years of development implementing hundreds of things MongoDB doesn't do, not merely doing the same schema-less stuff and tuning it for speed.

Re: PostgreSQL as Schemaless Database [pdf]

#35
post #24

So, the problem that I have with PostgreSQL isn't that it doesn't have every datastore under the sun, but rather the lack of automated distribution, and fault-tolerance. This is not a hard thing to build though (continue reading please). I don't mean that it's an easy task, but that the semantics by which you may be able to build a fault-tolerant, distributed database on top of Postgresql are pretty straightforward.…

Hot Standby in postgres is pretty damn good for replication (like you said making failover occur properly takes a little bit of effort but its not too hard).

Also pgpool2 helps a lot with partitioning and parallel queries.

For a relational db, postgres does a pretty good job at distribution and fault tolerance.

Re: PostgreSQL as Schemaless Database [pdf]

#36
post #10

Where is taligent when we need him? MongoDB is pretty impressive considering its age to the market, but I'd still go with the relational version of PostgreSQL anyday. Not because of the benchmarks, but in general, most use-cases are covered well enough by our relational db's like MySQL and PostgreSQL. The most expensive mistake one could make is using a NoSQL db where an SQL db fits perfectly. I admittedly made this…

You managed to choose the worst new database out there to call impressive :) Cassandra is impressive. Mongo? Not so much.

Re: PostgreSQL as Schemaless Database [pdf]

#37

I am always wondering why no-sql has better performance than SQL if we have same simple use case (no join etc.). If the data is well structured and no join is needed, can I assume that relational database should have better performance than no-SQL?

Depends what you mean by "NoSQL". MongoDB is pretty terrible overall, so don't even bother.

Systems like Dynamo/Riak/Cassandra sacrifice consistency (most of the time) for performance, largely because a distributed setup (sharding in particular) is easier when you don't guarantee consistency. Note that none of them sacrifice durability.

It is possible to have a distributed and consistent database, but you either have a bottleneck (master nodes in BigTable/HBase), require significant infrastructure (Google Spanner) or make schema changes very hard (Hyperdex). It's a hard problem.

Re: PostgreSQL as Schemaless Database [pdf]

#38

would it be possible to build an extension to expose a mongo compatible interface in postgres - essentially being able to use all the ORM/code built around mongo for postgres, seamlessly.

Yes, but why bother? There are already so many good SQL clients out there, like SQLAlchemy.

Re: PostgreSQL as Schemaless Database [pdf]

#39
Sadly it's not a fair fight, of course it'll beat Mongo (even though Postgres is ACID).

I would be more interested in comparing the biggest machine you can get on AWS running Postgres with a cluster of smaller machines running Cassandra. I expect Cassandra to win, but of course it's not consistent.

Re: PostgreSQL as Schemaless Database [pdf]

#40
post #28

Would be interesting to know which version of MongoDB was used (2.4 also uses V8). The original slides are at: https://wiki.postgresql.org/images/b/b4/Pg-as-nosql-pgday-fo... There is also another presentation on the use of PL/V8 (on Heroku) at the PostgreSQL wiki - from last week's NYC talks: http://plv8-talk.herokuapp.com/#1

In one slide it says he used MongoDB 2.2 on his mac.
Post reply on HN