Part of the EllisLab Network
   
2 of 2
2
MySQL vs. PostgreSQL
Posted: 20 February 2007 12:33 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
RankRank
Total Posts:  173
Joined  11-29-2006

Constraints and joins—everyday. Triggers, occasionally. But I don’t have a use for a lot of other things at this time.

Profile
 
 
Posted: 20 February 2007 12:49 PM   [ Ignore ]   [ # 17 ]  
Summer Student
Total Posts:  8
Joined  02-19-2007
Gunnar Lundström - 20 February 2007 12:25 PM

Out of curiosity, and totally offtopic. How many is there that use the “interresting” features, that is stuff other than basic insert/select/update/delete on a somewhat-daily basis?

Well, hopefully at some point you’d start using them even in MySQL since it now supports foreign keys and stored procs, etc.  As you get more into development and architecture, you’re going to find some of the solutions that postgres provides to be invaluable and part of how you define/build your entire application.

Since you are using Code Igniter you are already exposing yourself to a paradigm that is just as applicable to building the database as it is the code that interacts with it.  I come from an enterprise applications background, so it’s ingrained in me that the database is almost a seperate application onto itself and that you are actually building two applications, the front-end and the back-end. 

Most enterprise apps I’ve built in the past have strict access requirements, typically other applications (such as a PHP front-end) only have privileges to interact with the database through a defined set of stored procedures, so - in essence - you build an API to the database using stored procedures and lock down an application’s access through those stored procs.  In most commercial RDBMS systems, stored procedures offer a better execution plan than adhoc queries and you can apply a level of security to the entire thing that you couldn’t do allowing straight SQL adhoc queries to come from applications.  Straight SQL is usually strictly forbidden from other applications and considered bad practice.  By “hiding” the database behind a set of stored procedures, you’ve abstracted it enough that you can alter your schema without affecting the applications using it.  The same goes with using Views to consolidate more complicated queries into a unified view. 

That said, this is happening less and less lately, but in an ideal situation, that’s how I’d architect most of my applications - maybe not the simple quick ones or when I’m doing R&D, but most certainly for anything I’m putting in front of a large public audience.

Profile
 
 
Posted: 22 February 2007 02:57 PM   [ Ignore ]   [ # 18 ]  
Summer Student
Avatar
Total Posts:  20
Joined  02-07-2007

I think most PHP hacker have come to use MySQL because it was supported natively by PHP almost from the beginning. And as PHP grew, so did MySQL, almost version number for version number.

Also, MySQL is usually sufficient to do everything a web app needs.

And, most people just assume that all DBs are the same.

Port

For an unbiased comparison http://www-css.fnal.gov/dsg/external/freeware/pgsql-vs-mysql.html

 Signature 

“And I don’t want the world to see me | ‘Cause I don’t think that they’d understand
When everything’s meant to be broken | I just want you to know who I am”
                              —Goo Goo Dolls

Profile
 
 
Posted: 22 February 2007 03:13 PM   [ Ignore ]   [ # 19 ]  
Summer Student
Total Posts:  8
Joined  02-19-2007
s001dxp - 22 February 2007 02:57 PM

Also, MySQL is usually sufficient to do everything a web app needs.

I agree to a certain extent, it really depends on your requirements. 

The comparison link you posted is a bit dated as it’s comparing PostgreSQL 7, which is a different beast from 8.

Again, it’s whatever you’re comfortable with.  Coming from a hardcore DB background, I use a lot of features that postgres has had for a long time and am not really trusting - and perhaps this mis-trust is incorrect - MySQL as those features are too new and reports of performance in production environments sparse.

Both are fine choices.

Profile
 
 
Posted: 22 February 2007 11:47 PM   [ Ignore ]   [ # 20 ]  
Research Assistant
RankRankRank
Total Posts:  915
Joined  07-10-2006
Gunnar Lundström - 19 February 2007 10:15 AM

Yeah, it’s like just before the big bang… all software is getting more and more homogenic - all software becomes more and more alike [in the way they spit out data, presentation and some backend stuff still differs]...

I think the various database houses are being forced into compliance with the latest SQL specifications (which are actually fairly old considering the rapid pace of technology), so the features sets are progressively becoming similar. For years, MySQL was not close to meeting the specification set in 1992 but has showed an incredible amount of progress in recent years.  However, I’ve noticed that in recent years the dba pundits who previously shunned MySQL have taken to showing workaround solutions to difficult relational concepts because MySQL is so popular and because most database abstraction solutions include drivers for MySQL or because MySQL can be supported with ODBC drivers.

Getting MySQL queries ported over to more sophisticated RDBMS solutions is obviously going to be much simpler than the other way around. This could be construed as an asset for developers to an extent because their queries could be considered more portable to an exte.nt

Profile
 
 
Posted: 23 February 2007 01:12 AM   [ Ignore ]   [ # 21 ]  
Summer Student
Avatar
Total Posts:  20
Joined  02-07-2007

jawngee—yeah, you’re right, the link is dated.

Port

 Signature 

“And I don’t want the world to see me | ‘Cause I don’t think that they’d understand
When everything’s meant to be broken | I just want you to know who I am”
                              —Goo Goo Dolls

Profile
 
 
Posted: 23 February 2007 11:40 AM   [ Ignore ]   [ # 22 ]  
Summer Student
Total Posts:  15
Joined  01-31-2007

The MySQL-PHP “tag-team” relationship mentioned above is significant.  Also, until recently, postgresql did not have a Windows version unless you were willing to run it under cygwin.  Critical mass builds quickly.

Most of my recent experience (the last 6 years anyway) has been in Linux and Solaris, so postgresql has always been a viable option.  Until recently it wasn’t quite as fast as MySQL (not true now) but MySQL was likely faster because it was missing so many relational database features.  Now that it’s getting as feature-rich as Postgresql, it doesn’t have the same advantage, which is borne out by recent benchmarks.

But, don’t get me wrong, they’re both great and I use them both.

greg

Profile
 
 
Posted: 23 March 2007 01:45 PM   [ Ignore ]   [ # 23 ]  
Summer Student
Total Posts:  8
Joined  03-21-2007

Wow.  This topic of discussion is a very old one.  It is always full of fire and fury to be sure.  Also, anyone who has participated in this discussion over the years can tell you that their opinions have changed over time.  This is assured.  I have been using both for many a moon now as well as Oracle, Interbase(aka.Firebird) and various others as well as many through ODBC.  I will try to keep my opinion brief and to the point, because this topic often tends to be more religious than anything else when emotions get stirred up. 

Public perception as I see it

MySQL: Faster, easier to set up, easier to maintain, more fun.  Good enough, NASA uses it so it must be good enough for me.  Getting better all the time, supports transactions now and has become a real contender in the RDBMS world.  PhpMyadmin is great, and PHP and MySQL have been holding hands for years.  MySQL has availability from tons of hosting companies. 


PostgreSQL: Slower, harder to setup and tune.  More robust feature set, but most of which you won’t need and can live without.  Mature database built with ACIDITY in mind from the beginning.


My opinion on these topics

A few years ago I would have said I liked both, for different reasons.  But over the past few years I have watched MySQL lose focus of doing what it does best.  That is to say, I have always regarded MySQL as a vastly superior option to using a flat file db.  Now they are adding all kinds of features at the expense of speed and being lightweight.  PostgreSQL on the other hand over the past few years has continued down its path adding more and more Oracle level features and made major strides in terms of performance.  Amazing awesome unbelievable strides. 

Aside from MySQLs growth at the expense of performance and being lightweight, I also have always felt like the MySQL developers, much like the PHP developers just don’t get certain things.  They knowingly do things that are quite simply, wrong.  They understand why, and the implications but simply don’t feel it matters.  For instance, MySQL has never really supported the concept of NULL properly, and probably never will.  This is a problem.  I won’t go in to the details, but its just like PHP not supporting unicode and connection pooling.  Until enough people scream for it, they just don’t think its important.  The problem is that in the beginning it never is important enough, but in the long run it always is.  Then you are left to (sorry for the analogy) polish a turd, and friends, this is why MySQL will NEVER be, what PostgreSQL will be and has become. 

A few years ago I worked for an online gaming company that ran there entire backend on MySQL.  Imagine some 80 separate databases running independent to each other.  I cannot even begin to tell you what a nightmare that is.  There is no realistic way to deal with the capacity needed at that level.  What is worse, is the trap.  Everybody is guilty of it.  We’ll just use this now because its fast and simple, and if we need to switch to something better, we’ll do it when the time comes.  That single simple thought.  It took about 10 seconds to make, but about 2 years to fix during an Oracle migration.  How much more time would have been spent had MySQL not been used in the beginning?  Now granted, not everybody has aspirations this high, but those who foresee any level of success should certainly think more deeply.  At the time, we had several of the MySQL core engineer developers in house trying to help us figure out how to deal with the growing pains.  Transactions were the only real solution, and MySQL was not ready.  Some time later, they were and we tried them and they failed miserably under heavy load.  Maturity matters!  Being built with ACIDITY from the beginning matters!

Ok, I’ve gone on longer than I intended.  Let me finish by saying just a couple things that summarize my feeling about MySQL vs PG.  If you are building a blog, or a brochure site with some dynamic content, by all means use MySQL if you please.  If you have ever used PG, you probably know that it isn’t any harder to set up and despite the claims, will run just fine without tuning for applications with low concurrency such as you’d consider using MySQL for.  If there is money involved, in anyway beyond the most simplistic, do yourself a favor and use PG. 

One of the most useful aspects of a mature ORDBMS is the ability to store as much of the business logic as possible as close to the data as possible.  Enforcing business logic at the database level ensures that as little application code as possible need perform complex business logic on data and large chunks of data.  Enter transactions, store procedures and views.  The more you can use your database like an application, the less complicated your application layer will become, ultimately making your IP more portable to other application consumers or future growth.

In the end, for me personally there are very few times that something is insignificant enough to me that I care to use MySQL.  Honestly I think I would be using it more on smaller projects if it hadn’t lost focus of its core strength.  Simplicity!  The other thing is PostgreSQL is just so damn GOOD now!  Free, Fast, scalable, and full featured.  As soon as replication is supported natively, then we can begin arguing for years on the topic of PG vs Oracle.

Profile
 
 
Posted: 23 March 2007 02:07 PM   [ Ignore ]   [ # 24 ]  
Grad Student
Rank
Total Posts:  67
Joined  09-28-2006

fantastic words of wisdom z_malloc, thanks for taking the time to post all of that, it was a great read

Profile
 
 
Posted: 23 March 2007 03:07 PM   [ Ignore ]   [ # 25 ]  
Summer Student
Total Posts:  8
Joined  03-21-2007

sorry to keep going.. just one more thing i HAD to mention.  dba tools can make or break the experience of using one particular db vs another.  if you think PhpMyAdmin is good, check out the products from EMS.  They are to the database what Photoshop is to the bitmap.  Expensive, but unparalleled.

http://www.sqlmanager.net/products/postgresql/manager


this is how to build a schema!
http://www.sqlmanager.net/products/postgresql/manager/screenshots/255

Profile
 
 
Posted: 29 March 2007 06:49 PM   [ Ignore ]   [ # 26 ]  
Grad Student
Rank
Total Posts:  89
Joined  11-28-2006

postgesql for windows is not very user-friendly..
it needs to be run with a non-administrator account, it has to bypass FAT/32 disk partitions.
Though meant for us users’ own safty, those methods can also frustrate some people who new to the db system and do not speak english. Examples can be found among my colleagues as their installed psql server didn’t start working after clicking installer, they uninstalled postsql and back to using mysql.

 Signature 

Mastery in paining you with code.

Profile
 
 
Posted: 29 March 2007 08:11 PM   [ Ignore ]   [ # 27 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1739
Joined  06-23-2006

Yes, thanks z_malloc. Excellent explanation.

 Signature 

Mac OS X 10.4.10, Apache 1.3.3, PHP 5.2.3, CodeIgniter 1.5.x., baby!

Profile
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 66413 Total Logged-in Users: 35
Total Topics: 84753 Total Anonymous Users: 0
Total Replies: 454826 Total Guests: 213
Total Posts: 539579    
Members ( View Memberlist )
Newest Members:  byrooNirCalexmuellerkizerdrixcaptainredmuffquinodligtharttechsivamDjordjesammozza