With the release of PostgreSQL 9.3 and its native support for JSON data types, is PostgreSQL a better or more robust replacement for "NoSQL" type solutions like MongoDB?
-
Answer:
No. For a couple of reasons... 1) JSON is just text with some formatting rules applied. Even Postgre's documentation says so (http://www.postgresql.org/docs/9.3/static/datatype-json.html): Such data can also be stored as text, but the json data type has the advantage of checking that each stored value is a valid JSON value. 2) MongoDB still operates on the principal of documents accessed by key-value pairs. PostgreSQL is a relational DBMS with full ACID support and ANSI SQL compliance. 3) MongoDB scales horizontally without much effort. The best example of PostgreSQL scaling is Greenplum (and is quite expensive).
Chris Schrader at Quora Visit the source
Other answers
This question actually has 2 questions and a poorly-defined term. Let's clear this up before we get to an actual answer. ... "NoSQL" type solutions like MongoDB "NoSQL" is a very broad term. See my review here () for an overview. MongoDB is a "Document-Oriented" DB solution which is clearly a different family than PostgreSQL. Then you have two questions ... is PostgreSQL a better version of a Document-Oriented DB ... is PostgreSQL a more robust version of a Document-Oriented DB The answer to "more Robust" really depends on the "Document-Oriented DB" that you select. Riak, CouchDB, MongoDB and RaventDB all have different operational qualities. One person's "Robustness" is another person's "slow". Each of these Document DBs makes a series of "data security" choices or even provide you with a "pick your own". For example, Riak just started offering a "strong consistency" mode over its "eventual consistency" mode. (http://www.theregister.co.uk/2013/10/30/riak_version_two_teaser/). And of course the feature you're highlighting is new. So even if it replaces some "document-oriented" features, it's clearly going to fail "Robust" until it's had a few years in the wild. The answer to "better" is not something I'm going to answer. Final Answer: "I can't answer this question" Sometimes, you have to ask the right questions, I'm not sure yours are the right questions.
Gaëtan Voyer-Perrault
The JSON data type, its operators and Postgres's expression indices do offer a "schemaless" approach to storage. But only partially: every document is ultimately a field in a row, not an element of a root document. Auto-generation of timestamps, IDs, or UUIDs naturally does not apply to these datatypes when they are stored in JSON documents (where they will be strings). Postgres's many nice operators for these datatypes (and others) will apply only once the JSON has had appropriate extractions and casts applied to it. (Hash lookup and array indexing are some of the operators available for JSON.) Many applications get by just fine without this stuff, though. So you could imagine a "thing" table with an ID, a timestamp and a JSON column: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; CREATE TABLE IF NOT EXISTS thing ( id uuid PRIMARY KEY DEFAULT uuid_generate_v4(), t timestamptz NOT NULL DEFAULT now(), what text NOT NULL, -- Type of thing data json NOT NULL DEFAULT '{}' ); Now put all your things in it and you have a nice ACID, schemaless store that's got great administrative features. You can use separate tables for separate things without much duplication, too: CREATE TABLE other_thing ( LIKE thing INCLUDING DEFAULTS, PRIMARY KEY (id) ); You have to write all the query code yourself, though -- there aren't drivers or tools that will know how to map from object properties to a query against a JSON column! Addenda There was a recent talk about improvements in Postgres's HStore, a hash-map column type which has seen a fair amount of work as far as efficient storage and indexing, to make it more compatible with the JSON data model. http://www.sai.msu.su/~megera/postgres/talks/hstore-dublin-2013.pdf There is limited support for types in the new HStore "document" -- numbers and booleans and arrays, for example. A JSON column based on this HStore would be a true structured document.
Jason Dusek
Definitely not. JSON is merely the format your content is saved into the database as. MongoDB technically doesn't store your data using plain old JSON either, MongoDB uses something called BSON (Binary JSON) which offers significant speed advantages. If you want a fast read and write database that isn't ACID compliant then choose Mongo. If things like ACID compliance are important to you, choose an RDBMS (relational database management system) like Postgresql or MySQL.
Dwayne Charrington
Related Q & A:
- How to set value in the dropdown from a JSON data list?Best solution by Stack Overflow
- How do I create an HTML table, in jQuery, with JSON data?Best solution by Stack Overflow
- How to store json data in jquery?Best solution by Stack Overflow
- How do you replace a Crankshaft position sensor on a 2003 Saab 9-3?Best solution by Yahoo! Answers
- How reliable is a 2000 Saab 9-3?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.