For a beginner, is there much difference between MySQL and PostgreSQL [closed]
Want to improve this question? Update the question so it can be answered with facts and ci开发者_开发技巧tations by editing this post.
Closed 2 years ago.
Improve this questionIS there much difference between MySQL and PostgreSQL for a beginner like me, using basic select statements and the like, or are the main differences with using more advanced queries?
The reason why I usually suggest PostgreSQL before MySQL is because MySQL is far from the standards (SQL-wise). It does not support the use of window functions (8.4 version), common table expressions (8.4), CHECK constraints, EXCEPT/MINUS operator, even FULL OUTER JOINs... Even though you may have never heard of these words, you'll have to use those concepts at some point.
I strongly suggest you to start with PostgreSQL, then you can learn what "real" SQL is. Then, you can decide if MySQL is sufficient or not.
P.S. I started with MySQL and I regretted it. I now use PostgreSQL and I love it.
There have already been a lot of great points in favor of PostgreSQL, but I am going to add 1 more:
PostgreSQL has the best documentation of any database product I have worked with.
This is why the documentation stands out:
- It actually teaches you the basics of SQL
- It is easy to understand
- It has good examples
- It is very well organized
- It isn't just a feature list with tech notes
- It is all around, well written
Other vendors should be ashamed of what they try and a pass off as documentation.
While you're just starting out I think you'll appreciate PostgreSQL's pgadminIII GUI tool more than you would those that I've tried for MySQL. This may just be my preference, however.
When you get past the basics you will definitely want to take advantage of PostgreSQL's support of window functions starting in version 8.4
I'd actually recommend PostgreSQL over MySQL for the window functions alone. Note that there are ways to emulate window functions in MySQL.
You often hear PostgreSQL enthusiasts argue that it's a "real" RDBMS, while MySQL is not. This kind of snobbery is dangerous for newcomers, because it comes after years of specific experiences that rub a certain way against a certain personality type. If you want to approach it in terms of what knowledge would benefit a beginner the most - you're far more likely to find people using MySQL out in the wild than PostgreSQL. Big sites built around open source software choose MySQL over PostgreSQL by a wide margin.
Personally, I like MySQL because it fits my development style - it just gets stuff done. I don't use foreign keys. I definitely don't use stored procedures. But what MySQL does, it does well and it does fast and it does it while giving me a happy "okay, that makes sense" feeling that I don't get with PostgreSQL (I've used both extensively). There's good community support for MySQL and excellent documentation. And if you need to do replication (and who doesn't?) MySQL is the clear winner, no questions asked.
There are some things that MySQL lets you do that could possibly lead to bad habits if you switch to less-forgiving databases. But that's the thing - there's all this talk of how you need to be prepared to jump from RDBMS X to RDBMS Y at a moment's notice. In my experience, this happens rarely, and when it does there are always quirky differences from one database to the next. MySQL is different from PostgreSQL, which is different from Oracle, which is different from SQL Server, which is different from sqlite, etc, etc. I've used all the dbs I listed above, but the one I keep coming back to, the one that gets things done most easily and flexibly for me, is MySQL.
DBAs love to put down MySQL the same way programming language aficionados love to bash PHP - and yet they survive and thrive. There are reasons for this - they just work, they just get stuff done. But at the end of the day you should play around with all of it and make up your own mind.
I would recommend PostgreSQL for a beginner as it has far fewer surprises than MySQL.
Here are some of the things that people run into with MySQL:
- http://blog.amber.org/2005/09/27/least-common-denominator/
- http://arstechnica.com/civis/viewtopic.php?f=20&t=92525
- http://exortech.com/blog/2009/11/30/weekly-release-53-environment-bug-bites/
Meanwhile, PostgreSQL does exactly what you expect it to do in most situations, and usually has a very good reason when it does something unexpected.
PostgreSQL supports more advanced queries, it performs better on complicated queries, but is harder to manage.
MySQL is fast, easy to manage, but you can run into it's limitations on advanced queries, stored procedures and the like.
They are sufficiently similar that I'd recommend starting with MySQL but learning PostgreSQL as well.
精彩评论