MongoDB and PostgreSQL thoughts

前端 未结 6 1990
伪装坚强ぢ
伪装坚强ぢ 2020-12-24 02:19

I\'ve got an app fully working with PostgreSQL. After reading about MongoDB, I was interested to see how the app would work with it. After a few weeks, I migrated the whole

相关标签:
6条回答
  • 2020-12-24 02:36

    I haven't used MongoDB yet, and may never get round to it as I haven't found anything I can't do with Postgres, but just to quote the PostgreSQL 9.2 release notes:

    With PostgreSQL 9.2, query results can be returned as JSON data types. Combined with the new PL/V8 Javascript and PL/Coffee database programming extensions, and the optional HStore key-value store, users can now utilize PostgreSQL like a "NoSQL" document database, while retaining PostgreSQL's reliability, flexibility and performance.

    So looks like in new versions of Postgres you can have the best of both worlds. I haven't used this yet either but as a bit of a fan of PostgreSQL (excellent docs / mailing lists) I wouldn't hesitate using it for almost anything RDBMS related.

    0 讨论(0)
  • 2020-12-24 02:38

    Let's quote what you wrote and see what it tells us:

    "I like a few things with Mongodb. However, I found certain queries I was
     doing in PostgreSql, I couldn't do efficiently in Mongodb. Especially,
     when I had to join several tables to calculate some logic."
    
    "I found the ODM to be very limiting compared to what Active Record offered
     with traditional (SQL) database systems."
    
    "I feel more comfortable working with PostgreSql than Mongodb. Only because
     I can join tables and do anything with the data."
    

    Based on what you've said it looks to me like you should stick with PostgreSQL. Keep an eye on MongoDB and use it if and when it's appropriate. But given what you've said it sounds like PG is a better fit for you at present.

    Share and enjoy.

    0 讨论(0)
  • 2020-12-24 02:43

    My experience with Postgres and Mongo after working with both the databases in my projects .

    Postgres(RDBMS)

    Postgres is recommended if your future applications have a complicated schema that needs lots of joins or all the data have relations or if we have heavy writing. Postgres is open source, faster, ACID compliant and uses less memory on disk, and is all around good performant for JSON storage also and includes full serializability of transactions with 3 levels of transaction isolation.

    The biggest advantage of staying with Postgres is that we have best of both worlds. We can store data into JSONB with constraints, consistency and speed. On the other hand, we can use all SQL features for other types of data. The underlying engine is very stable and copes well with a good range of data volumes. It also runs on your choice of hardware and operating system. Postgres providing NoSQL capabilities along with full transaction support, storing JSON documents with constraints on the fields data.

    General Constraints for Postgres

    Scaling Postgres Horizontally is significantly harder, but doable.

    Fast read operations cannot be fully achieved with Postgres.

    NO SQL Data Bases

    Mongo DB (Wired Tiger)

    MongoDB may beat Postgres in dimension of “horizontal scale”. Storing JSON is what Mongo is optimized to do. Mongo stores its data in a binary format called BSONb which is (roughly) just a binary representation of a superset of JSON. MongoDB stores objects exactly as they were designed. According to MongoDB, for write-intensive applications, Mongo says the new engine(Wired Tiger) gives users an up to 10x increase in write performance(I should try this), with 80 percent reduction in storage utilization, helping to lower costs of storage, achieve greater utilization of hardware.

    General Constraints of MongoDb

    The usage of a schema less storage engine leads to the problem of implicit schemas. These schemas aren’t defined by our storage engine but instead are defined based on application behavior and expectations.

    Stand-alone NoSQL technologies do not meet ACID standards because they sacrifice critical data protections in favor of high throughput performance for unstructured applications. It’s not hard to apply ACID on NoSQL databases but it would make database slow and inflexible up to some extent. “Most of the NoSQL limitations were optimized in the newer versions and releases which have overcome its previous limitations up to a great extent”.

    1. Which one would be more suitable for developing a social networking site similar to Facebook? Facebook currently uses combination of databases like Hive and Cassandra.
    2. Which one would be more suitable for 4-page standard layout type of website (Home, Products, About, Contact) Again it depends how you want to store and process your data. but any SQL or NOSQL database would do the job.
    0 讨论(0)
  • 2020-12-24 02:46

    You dumped a decades-tested, fully featured RDBMS for a young, beta-quality, feature-thin document store with little community support. Unless you're already running tens of thousands of dollars a month in servers and think MongoDB was a better fit for the nature of your data, you probably wasted a lot of time for negative benefit. MongoDB is fun to toy with, and I've built a few apps using it myself for that reason, but it's almost never a better choice than Postgres/MySQL/SQL Server/etc. for production applications.

    0 讨论(0)
  • 2020-12-24 02:50

    First of all postgres is an RDBMS and MongoDB is NoSQL .
    but Stand-alone NoSQL technologies do not meet ACID standards because they sacrifice critical data protections in favor of high throughput performance for unstructured applications.

    Postgres 9.4 providing NoSQL capabilities along with full transaction support, storing JSON documents with constraints on the fields data.

    so you will get all advantages from both RDBMS and NoSQL

    check it out for detailed article http://www.aptuz.com/blog/is-postgres-nosql-database-better-than-mongodb/

    To experience Postgres' NoSQL performance for yourself. Download the pg_nosql_benchmark at GitHub. here is the link https://github.com/EnterpriseDB/pg_nosql_benchmark

    0 讨论(0)
  • 2020-12-24 03:02

    We also have research on the same that which is better. PostGres or MongoDb. but with all facts and figures in hand, we found that PostGres is far better to use than MongoDb. in MongoDb, beside eats up memory and CPU, it also occupies large amount of disk space. It's increasing 2x size of disk on certain interval.

    0 讨论(0)
提交回复
热议问题