<p>I am working on a web application using Python (Django) and would like to know whether MySQL or PostgreSQL would be more suitable when deploying for production.</p>
<p>In one <a href="https://blog.stackoverflow.com/2008/06/podcast-8/">podcast</a> Joel said that he had some problems with MySQL and the data wasn't consistent.</p>
<p>I would like to know whether someone had any such problems. Also when it comes to performance which can be easily tweaked?</p>

[{'answer_id': 27439, 'author': 'SCdF', 'author_id': 1666, 'author_profile': 'https://Stackoverflow.com/users/1666', 'pm_score': 2, 'selected': False, 'text': "<p>Well, I don't think you should be using a different database brand in anything past development (build, staging, prod) as that will come back to bite you.</p>\n\n<p>From how I understand it PostgreSQL is a more 'correct' database implementation while mySQl is less correct (less compliant) but faster.</p>\n\n<p>So if you are pretty much writing a CRUD application mySQL is the way to go. If you require certain features out of your database (if you're not sure then you don't) then you may want to look into postgreSQL.</p>\n"}, {'answer_id': 27440, 'author': 'Josh', 'author_id': 257, 'author_profile': 'https://Stackoverflow.com/users/257', 'pm_score': 8, 'selected': True, 'text': '<p><strong>A note to future readers:</strong> The text below was last edited in August 2008. That\'s nearly 11 years ago as of this edit. Software can change rapidly from version to version, so before you go choosing a DBMS based on the advice below, do some research to see if it\'s still accurate.\nCheck for newer answers below.</p>\n\n<hr>\n\n<p>Better?</p>\n\n<p>MySQL is much more commonly provided by web hosts.</p>\n\n<p>PostgreSQL is a much more mature product.</p>\n\n<p>There\'s <a href="http://www.databasejournal.com/features/mysql/article.php/3288951" rel="noreferrer">this discussion addressing your "better" question</a> </p>\n\n<p>Apparently, according to <a href="http://www.teknico.net/devel/myvspg/index.en.html" rel="noreferrer">this web page</a>, MySQL is fast when concurrent access levels are low, and when there are many more reads than writes. On the other hand, it exhibits low scalability with increasing loads and write/read ratios. PostgreSQL is relatively slow at low concurrency levels, but scales well with increasing load levels, while providing enough isolation between concurrent accesses to avoid slowdowns at high write/read ratios.  It goes on to link to a number of performance comparisons, because these things are very... sensitive to conditions.</p>\n\n<p>So if your decision factor is, "<strong>which is faster?</strong>"  Then the answer is "it depends.  <strong>If it really matters, test your application against both.</strong>"  And if you really, really care, you get in two DBAs (one who specializes in each database) and get them to tune the crap out of the databases, and then choose.  It\'s astonishing how expensive <em>good</em> DBAs are; and <em>they are worth every cent</em>.  </p>\n\n<p>When it matters.  </p>\n\n<p>Which it probably doesn\'t, so just pick whichever database you like the sound of and go with it; better performance can be bought with more RAM and CPU, and more appropriate database design, and clever stored procedure tricks and so on - and all of that is cheaper and easier for random-website-X than agonizing over which to pick, MySQL or PostgreSQL, and specialist tuning from expensive DBAs.</p>\n\n<p><hr>\nJoel also said in that podcast that comment would come back to bite him because people would be saying that MySQL was a piece of crap - Joel couldn\'t get a <code>count</code> of rows back.  The plural of anecdote is not data.  <a href="https://stackoverflow.fogbugz.com/default.asp?W6080" rel="noreferrer">He said</a>:</p>\n\n<blockquote>\n  <p>MySQL is the only database I\'ve ever programmed against in my career that has had data integrity problems, where you do queries and you get nonsense answers back, that are incorrect.  </p>\n</blockquote>\n\n<p>and he also said:</p>\n\n<blockquote>\n  <p>It\'s just an anecdote.  And that\'s one of the things that frustrates me, actually, about blogging or just the Internet in general. [...] There\'s just a weird tendency to make anecdotes into truths and I actually as a blogger I\'m starting to feel a little bit guilty about this</p>\n</blockquote>\n'}, {'answer_id': 27443, 'author': 'tslocum', 'author_id': 1662, 'author_profile': 'https://Stackoverflow.com/users/1662', 'pm_score': 1, 'selected': False, 'text': "<p>If you are writing an application which may get distributed quite a bit on different servers, MySQL carries a lot of weight over PostgreSQL because of the portability.  PostgreSQL is difficult to find on less than satisfactory web hosts, albeit there are a few. In most regards, PostgreSQL is slower than MySQL, especially when it comes to fine tuning in the end. All in all, I'd say to give PostgreSQL a shot for a short amount of time, that way you aren't completely avoiding it, and then make a judgement.</p>\n"}, {'answer_id': 27445, 'author': 'Grey Panther', 'author_id': 1265, 'author_profile': 'https://Stackoverflow.com/users/1265', 'pm_score': 4, 'selected': False, 'text': "<p>I haven't used Django, but I have used both MySQL and PostgreSQL. If you'll be using your database only as a backend for Django, it doesn't matter much, because it will abstract away most of the differences. PostgreSQL is a little more scalable because it doesn't hit the brick wall as fast as MySQL as data-size/client-count increase.</p>\n<p>The real difference comes in if you are doing a new system. Then I'd recommend PostgreSQL hands down, because it has a lot more features which make your DB layer much more customizable, so that you can fine-tune it to any requirements you might have.</p>\n"}, {'answer_id': 27529, 'author': 'Stephen Cox', 'author_id': 534, 'author_profile': 'https://Stackoverflow.com/users/534', 'pm_score': 0, 'selected': False, 'text': "<p>Thank you. I've used Django with MySQL and it's fine. Choose your database on the features you need. Hard to compare MySQL and Postgres. Better to compare Postgress to SQl Server.</p>\n"}, {'answer_id': 27558, 'author': 'Greg Hewgill', 'author_id': 893, 'author_profile': 'https://Stackoverflow.com/users/893', 'pm_score': 3, 'selected': False, 'text': '<p>Although it\'s a bit out of date, it would be worth reading the <a href="http://sql-info.de/mysql/gotchas.html" rel="noreferrer">MySQL Gotchas</a> page. Many of the items listed there are still true, to the best of my knowledge.</p>\n\n<p>I use PostgreSQL.</p>\n'}, {'answer_id': 103326, 'author': 'WolfmanDragon', 'author_id': 13491, 'author_profile': 'https://Stackoverflow.com/users/13491', 'pm_score': -1, 'selected': False, 'text': '<p>MySQL is a <a href="http://en.wikipedia.org/wiki/Relational_database_management_system" rel="nofollow noreferrer">relational database management system</a> while PostgreSQL is an <a href="http://en.wikipedia.org/wiki/Object-relational_database_management_system" rel="nofollow noreferrer"><strong>object</strong>-relational database management system</a>. PostgreSQL is suited well for C++ or Java developers, as it gives us more control over how queries are written. ORDBMS also gives us Objects and User Defined Types. The SQL queries themselves are much closer to the ISO standards than MySQL.<br>\nDo you need an ORDBMS or a RDBMS? That will better answer your question.  </p>\n'}, {'answer_id': 189929, 'author': 'marcospereira', 'author_id': 4600, 'author_profile': 'https://Stackoverflow.com/users/4600', 'pm_score': 0, 'selected': False, 'text': '<p>@WolfmanDragon</p>\n\n<p>PostgreSQL has (tiny) support for objects, but it is, by nature, a relational database. From its <a href="http://www.postgresql.org/about/" rel="nofollow noreferrer">about page</a>:</p>\n\n<blockquote>\n  <p>PostgreSQL is a powerful, open source <strong>relational</strong> database system.</p>\n</blockquote>\n'}, {'answer_id': 1230563, 'author': 'Lance Rushing', 'author_id': 150463, 'author_profile': 'https://Stackoverflow.com/users/150463', 'pm_score': 3, 'selected': False, 'text': '<p>I use both extensively.  My choice for a particular project boils down to:</p>\n<ul>\n<li>Licensing - Are you going to distribute your app (IANAL)</li>\n<li>Existing Infrastructure and Knowledge Base</li>\n<li>Any <em>special sauce</em> you have to have.</li>\n</ul>\n<hr />\n<p>By <em>special sauce</em> I mean things like:</p>\n<ul>\n<li>Easy/cheap replication = MySQL</li>\n<li>Huge dataset problems with small results = PostgreSQL. Use the language extensions, and have very efficient data operations. (PL/Python, PL/TCL, PL/Perl, etc)</li>\n<li>Interface with R Statistical Libraries = PostgreSQL <a href="http://www.joeconway.com/plr/" rel="nofollow noreferrer">PL/R</a> <em>available in debian/ubuntu</em></li>\n</ul>\n'}, {'answer_id': 2436575, 'author': 'Summer', 'author_id': 261385, 'author_profile': 'https://Stackoverflow.com/users/261385', 'pm_score': 4, 'selected': False, 'text': "<p>Just chiming in many months later.</p>\n\n<p>The geographical capabilities of the two databases are very, very different.  PostgreSQL has the exceptional PostGIS extension.  MySQL's geographical functionality is practically zero in comparison. </p>\n\n<p>If your web service has a location component, choose PostgreSQL.</p>\n"}]
['https://Stackoverflow.com/questions/27435', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1448/']