PostgreSQL 7.3 Released 315
rtaylor writes "Nearly a year's worth of work is out. The new tricks include schema support, prepared queries, dependency tracking, improved privileges, table (record) based functions, improved internationalization support, and a whole slew of other new features, fixes, and performance improvements. Release Email - Download Here - Mirror FTP sites (at bottom)."
Cool! PostgreSQL always runs on my iBook (Score:2, Interesting)
-Mark
Comment removed (Score:5, Funny)
Re:Cool! PostgreSQL always runs on my iBook (Score:2, Funny)
Re:Cool! PostgreSQL always runs on my iBook (Score:2)
Quick question (Score:5, Interesting)
Re:Quick question (Score:4, Interesting)
Table Functions : Functions returning multiple rows and/or multiple columns are now much easier to use than before. You can call such a "table function" in the SELECT FROM clause, treating its output like a table. Also, PL/pgSQL functions can now return sets.
Re:Quick question (Score:3, Informative)
-Sokie
Re:Quick question (Score:2)
There are a few things on the developers minds prior to replication. 2 Phase commits, improved inter-database connections (see dblink), Point in Time Recovery (via WAL logs).
Once any 2 of the above three are completed, then replication should be a piece of cake
That said, I'm holding out on asynchronous multi-master replication.
Re:Quick question (Score:5, Insightful)
I think that's the sort of thing that as soon as that feature is filled in, people will say it's "just" something else that's missing. There are a bunch of features I can think of that would be nice and PostgreSQL doesn't have. And probably there's someone who considers each one to be vital:
Re:Quick question (Score:2)
But really it's free and it's great. If you want oracle like features you are going to pay oracle prices.
Re:Quick question (Score:2)
Maybe, but I have had to disqualify postgresql from consideration becasue of this issue on two projects this year. I really would have preferred to use it, too. I can't say that about any other feature.
Re:Quick question (Score:3, Informative)
Planned for 7.4 IIRC.
Good Win32 support.
Planned for 7.4. Seems code is already available, it's just being cleaned up prior toward merge.
Any clue when it will support.... (Score:2)
Dropping Columns finally supported (Score:5, Informative)
DROP COLUMN [column] FROM TABLE [table];
This up-until-now lacking feature has been the bane of my existence. I HATE cruft being left lying around.
(btw, I don't know if that is the correct syntax, just a guess)
Re:Dropping Columns finally supported (Score:2)
Re:Dropping Columns finally supported (Score:2)
Because PostgreSQL and Oracle are designed to be a 24/7 live database. With most of the othere databse packages, you have to disconnect everybody then rename/drop columns. This feature is not terrably usefull if you can't do it while the database is running.
As an aside, you alway could do this with a down PostgreSQL database: dump the database, then rename, then reload.
You can *now* do this with a *live* PostgreSQL database.
Re:Dropping Columns finally supported (Score:2)
Re:Dropping Columns finally supported (Score:3, Informative)
Re:Dropping Columns finally supported (Score:3, Informative)
Not sure whether it's the same in Postgresql, but in oracle, it would be:
Re:Dropping Columns finally supported (Score:3, Interesting)
And you can rename tables and colums on the fly too!
And the default identifier length is 63! ForReallyLongAndDescriptingColumnNames!
For all you people out there with Access who think this is old hat - the tables and column renaming and droping can happpen while people are connected to the PostgreSQL database - you don't have to kick anybody off the database.
If you're considering migrating your Aceess database to MS SQL Servier - do consider PostgreSQL. From experience, the amount of suffering is about the same for both transitions, but when your done, PostgrSQL is more robust, less expensive and less buggy.
Re:Dropping Columns finally supported (Score:2)
AND it doesn't have the nasty side-effect of being owned, controlled, and licensed by Microsoft.
Re:Dropping Columns finally supported (Score:3, Informative)
Oh, it's even better than that. You can do these things within transactions. If you rename a table within a transaction and abort the transaction, it's as if the rename never took place.
This is very cool stuff. I suspect that dropping columns works the same way. It means that you can do things like exchange table names atomically.
Re:Dropping Columns finally supported (Score:2)
Oh, it's even better than that. You can do these things within transactions.
Good greif, that's cool! Do a whole database transformation in a transaction, and if it borks out, it rolls back? Cool!
Re:Dropping Columns finally supported (Score:2)
Yeah, it is cool. The side effect, of course, is that the space from DROP COLUMN can't be automaticaly reclaimed - for that you need to run a VACCUM FULL, which does need an exclusive lock. You can batch updates, however, and then do the vaccum at some time in the future when the db isn't being heavily used (ie 3am on a public holiday)
Newly added rows don't have much overhead for the dropped columns though, apparently. The postgresql websties are still pointing to 7.2 docs, but 7.3 says:
"The DROP COLUMN command does not physically remove the column, but simply makes it invisible to SQL operations. Subsequent inserts and updates of the table will store a NULL for the column. Thus, dropping a column is quick but it will not immediately reduce the on-disk size of your table, as the space occupied by the dropped column is not reclaimed. The space will be reclaimed over time as existing rows are updated. To reclaim the space at once, do a dummy UPDATE of all rows and then vacuum, as in:
UPDATE table SET col = col;
VACUUM FULL table;"
Re:Dropping Columns finally supported (Score:2, Interesting)
OK, you've got my attention. This is something I hope to do more of in the future and being that you have some expirience, I'd like to ask a couple questions...
I'm sure there's more issues I'd run accross, but this is all I can think of setting on my couch during my extended weekend away from work :)
Re:Dropping Columns finally supported (Score:3, Informative)
I guess it depends where your head sits.
Dave
Re:Dropping Columns finally supported (Score:5, Informative)
1. I recently did an Access to MS SQL conversion and ended up with an access database in
Nope, You do need a PostgreSQL ODBC driver, but the link settings can be managed by your Access databsse if you relink on client startup with a VBA script.
2. In that conversion, the
You can store the queires as views on the PostgreSQL server - no problem there. In 7.3 procedures can return a set of data now - though, I'm waiting for reports from the field to come back and report that it's working well before I jump on it myself.
3. MS SQL allows you to use your current windows credentials as the authentication to the SQL server. This is nice because then the users don't have to enter/remember another password. Can I do this in Postgre?
I don't think there is any way you can do that in the PosgreSQL ODBC driver - you could rewire the ODBC link on the fly though. Another login is a pain in the ass, but nobody seems to care. It may be possible to get this to work with a Linux server through PAM - if you can get PostgreSQL to work though PAM. I don't know, though.
4. I've found that Access generates absolutely horrid SQL. Fortunately, because all these queries are stored on the SQL server, they can be edited/optimized after the conversion. This question ends up being a two-parter. How compatible is Postre with Access' ugly SQL? And if there's a compatability problem with the generated SQL, can I at least edit it server side and make access not care that that's happened?
Both the PostgreSQL server and ODBC driver can massage the horrid Access built queries into normalacy. Typically you don't have to migrate the queries off of Access and into server views because of this - they just work. It's the KSQO that does the magic, from the docs: Key Set Query Optimizer causes the query planner to convert queries whose WHERE clause contains many OR'ed AND clauses (such as "WHERE (a=1 AND b=2) OR (a=2 AND b=3)
This hasen't always been the case, Access queries used to crash PostgreSQL a few years ago becuase they were so odd.
General thoughts on both:
It takes a *bit* longer to get Access to play with PostgreSQL but once it's there, there are no odd bugs to work out. Upgrade Jet to the latest version on the clinet boxes, and set the ODBC time out in the regestry from 600 to 0 - there's a bug in the way Access relinks to a timed-out ODBC session, so by setting the timeout to 0, it never times out.
The Access/ODBC driver sometimes has problems with creating a record using contininous forms - any new record should be created using VBA rather than by filling out the blank entry in an Access continuis form or list of records.
Good luck - I've been very happy with the migration myself.
Oh, setup an hourly cron job to dump the database to a file then gzip it and stash it on a NFS server. Easy hourly backups! Never had to use them, but it's nice to know that we'll never loose more than an hours worth of work!
Re:Dropping Columns finally supported (Score:2)
Dave
Re:Dropping Columns finally supported (Score:2)
I don't think there is any way you can do that in the PosgreSQL ODBC driver - you could rewire the ODBC link on the fly though. Another login is a pain in the ass, but nobody seems to care. It may be possible to get this to work with a Linux server through PAM - if you can get PostgreSQL to work though PAM. I don't know, though.
Even if not, this is Unix. A simple glue script to fetch the necessaries from Samba and push them into the Postgres authentication table(s) should do the trick.
When it works, make a hero of yourself, re-render it in C or something at least a little more robust than BASH or whatever you prototyped it in, and throw it at Postgres' contribs.
Re:Dropping Columns finally supported (Score:3, Informative)
You had to translate all those queries from access SQL to MS-SQL language right? They are incompatible in many ways. Also many access queries tend to have functions in them like dlookup() all of which won't work in SQL server. SO depending on the complexity of the SQL you will have to translate some of them.
"# MS SQL allows you to use your current windows credentials as the authentication to the SQL server. This is nice because then the users don't have to enter/remember another password. Can I do this in Postgre?"
You can embed a username and a password in the ODBC driver and have everybody log in as the same user or you can write some VB code to get the user name from the windows login and make right registry hacks. Not too big of an ordeal.
" 4. I've found that Access generates absolutely horrid SQL. Fortunately, because all these queries are stored on the SQL server, they can be edited/optimized after the conversion. This question ends up being a two-parter. How compatible is Postre with Access' ugly SQL? And if there's a compatability problem with the generated SQL, can I at least edit it server side and make access not care that that's happened?"
Pretty much the same as SQL server. You can create stored procedures or views and link them up like tables. Study up on the postgres RULE system. It basically allows you to create views with code and also makes all views writable if you want to code the writes.
Look into SQL Porter http://www.realsoftstudio.com/ordersqlporter.php it might save you a ton of work and it does not cost a lot of money.
You can also use "pass through" queries to take advantage of postgres features like regular expressions and such.
Re:Dropping Columns finally supported (Score:2, Informative)
Drop Column (Score:4, Interesting)
PostgreSQL now supports the ALTER TABLE
HURRAY! this has been my biggest annoyance with postgresql since I've started using it. there are workarounds for older versions, but they become arduous when you have a lot of existing data.
this is a *very welcomed* implementation.
Is there support for replication? (Score:2)
FINALLY!! (Score:4, Funny)
Dancing Girls
The PostgreSQL now includes a number of beautiful dancing girls
I can't tell you how long I've been waiting for this feature! Now I can get rid of Oracle for GOOD!!
Kudos to the PostgreSQL team!
I want replication. please. (Score:4, Interesting)
As of a couple of months ago none of the replication options for postgres were any good. Most were unreliable, offered very small features or very hard to set up.
Some looked like they had promise, but were not there.
Please, please, please, add replication to the next release
I also wish performance for simple case dbs was faster. eg key value dbs compared to the performance of sleepy cats berkley db.
I'm sure there would be a *lot* of money to be had if someone were to make a good replication system. Possibly releasing it blender styles? Or offering to implement replication for businesses for a fee?
Perhaps one of the postgres groups could ask for donations from some of us users so some developers could work on it full time. I know I could easily convince my boss to cough up for it. Almost any business that relies on postgres could be convinced to chip in I think.
Related question re. Database development (Score:2, Interesting)
There have been some references to msAccess here, what I like about Access is the ease I can build an ad hoc database application (but where the data could be reused easily should there be a later requirement).
While Postgres sounds great, I want to know if there are and tools that approach this ease of development, within a linux environment. Ability to choose the back-end database would be a huge plus - I'd certainly give Postgres a go.
RG
Re:Related question re. Database development (Score:2)
pgaccess does some of what access does.
Openoffice has nice database developmet tools.
You can build database apps very easily with kylix and there are even open source repirting engines available.
If all of that is not good enough then you can always use postgres as a back end to access via ODBC.
Re:Related question re. Database development (Score:3, Informative)
Unfotrunatly there is no all-in-one rapid developemnt and flat-file database rolled into one, like Access, in the Unix world. But don't let that stop you from using Access though - it's a great tool for rapid development.
I use it all the time - you rapidly develope the small database, and when it outgrown the Access flat-file
Once that is donem and your database is really popular - migrate the front end again to Delphi to Delphi/Kylix and you'll be able to support Linux/FreeBSD and Windows desktops. People can VNC into a FreeBSD server that shares the Kylix app over VNC for other systems - Solaris, Mac, Psion.
Cool stuff.
Re:Related question re. Database development (Score:2)
I've just started looking at Rekall by theKompany.com (KDE etc). It's quite Accesss-like, and it runs on Windows, Linux, and Mac. It only costs $70 too!
Not as versatile/powerful as Access yet, but I think it may get there.
PHP+PostgreSQL || PHP+MySQL (Score:2)
So, does PG+PHP match the speed of My+PHP? Is it as thoroughly tested? As I'm moving away from using Perl, I'd be really interested in seeing some benchmarks with this new version of PG...
Re:PHP+PostgreSQL || PHP+MySQL (Score:2)
The question shouldn't be whether PG+PHP matches teh speed of MySQL+PHP, but rather whether the speed of PG+PHP is good enough for your application and, more importantly, whether it will scale reasonably well under load.
This [phpbuilder.com] seems to indicate that PG+PHP will scale better than MySQL+PHP, but that will certainly depend on the configuration of MySQL (in particular, which table type you use).
You should be a lot more concerned about the features of the database that you will require, instead of the speed, because once you select a database engine you'll have a lot of trouble migrating to a different one. Speed can always be gained by throwing more hardware at the problem if necessary. Database features can't.
Re:PHP+PostgreSQL || PHP+MySQL (Score:2)
What the MySQL'ers dont understand (Score:5, Informative)
Postgresql has the *intellegence* built in. You can write all sorts of georgous functions to do stuff, especially if, like us, your shop uses several languages... PHP, Perl, Java, Python, C++, etc. Why replicate your business logic everywhere?
Transaction support and file/record locking are the least of your problems. If you do serious database stuff, at some point, you are *going* to want VIEWS, TRIGGERS, RULES, and STORED PROCEDURES (functions). Having this functionality in the database engine, instead of in your code makes a heck of a lot of difference when the time comes to scale.
Coming from a MySQL backgroud in a multi-language shop, we clearly saw the limitations, and decided to switch the entire database platform over to Postgresql a year ago.
We haven't looked back since.
Re:What the MySQL'ers dont understand (Score:2, Insightful)
Re:What the MySQL'ers dont understand (Score:3, Informative)
For the data intensive operations used within the business logic, it is often helpful to encapsilate the data access using an API that resides in the database. This stops large amount of data going across the network. For example, an order fulfilment system might have a middle tier that decided whether an order could be shipped. It might call a "get_backordered_part_count" function and make a series of decisions based on the result.
Implementing that function in the middle tier accomplishes nothing because the same SQL hits the DB either way. If the logic in the function is complicated and can only be coded with several SQL statements, the extra network traffic and server round trips can be unacceptable.
A lot of other situations call for Stored procedures and triggers. For example, they are appropriate for writing a data integrity layer: if you denormalize your data model for performance, you need to write triggers to enforce the data integrity. Similarly, if you have raw data processing operations as is common for external system interfaces, data load and transformation operations, periodic jobs etc then it is good to write these in the data layer unless you'd rather push lots of extra data across the network for no identifiable reason.
Making The Switch? (Score:3, Interesting)
Just today I found a need (not a chance to use, but a *need*) for a subquery. While contemplating copying and pasting (it's only like 30 rows) data between database tables, I happened to see this article.
How easy is it to switch over from MySQL to PostgreSQL? Is there a simple tool to convert between the two? (And as a sidenote... The machine I want to do this on is a third-hand computer, a 300 MHz, 128 MB RAM webserver... Am I going to notice a performance hit if I put PostgreSQL on it?)
Not hard (Score:4, Informative)
There are two scripts that come with PostgreSQL to take a database dump from MySQL and turn it into something you can use with PostgreSQL. So the switch is painless.
3 cautions, though
1) PostgreSQL timestams are time-zone independent, and the database manager will correct for timezone if set. So if your timestamps are off by a certain factor, that is probably why.
2) Timestamp format is different, so you may have to rewrite any time-stamp parsers.
3) Limit clauses in MySQL are non-standard.
Coming from someone who supports both
Re:Making The Switch? (Score:3, Interesting)
Zachary Beane [xach.com] of GIMP fame, has a MySQL to PostgreSQL [xach.com] migration page with a Perl script and some advice.
major feature missed in pgsql (Score:5, Insightful)
Too bad. When Internet burned tons of startup money, they hired lots of "so-called programmers" to do web-development stuff. No wonder that MySQL and PHP (and Linux!) was typically a choice. Who cares about transactions? Who cares about aspect separation? Just show the first home page to the boss!
The positive outcome: big bosses heard about Linux. Could Linux be where it is now without those so-called programmers? I doubt so. Professional Services from IBM and Microsoft would decide for you what technology to use after your boss has decided what partnership contract to sign.
But that wasn't the only way to "educate" big bosses about Linux: startup boom sparked Linux marketing boom creating OSDN, and others, including Slashdot. As a result, Linux is not self-selling itself: everyone loves Linux therefore Linux is protecting your investments. Crowd effect.
Could it be possible would Linux be really bad? No. Why it didn't happened to PostgreSQL? I think b/c PostgreSQL-based few companies didn't care about marketing. Or cared wrong. Or didn't have money to care. Compared to what? To Linux. Try to find some subject about Linux using google - besides mail-lists you've got many official documents, FAQs, HOWTOs, learning courses, support companies. Try to do it for PostgreSQL - mostly mail-lists and few official docs.
With improved better marketing PostgreSQL may become in one or two years as Linux today. Without good marketing only PostgreSQL developers, few enthusiasts and some Slashdot readers will know that not all open-source databases are so bad.
Re:major feature missed in pgsql (Score:4, Insightful)
On the other hand, Linux is the admiral ship for all open source software, it come bundled with it, Linux has chown that OS is viable and it's success will make OS prevail too. It only needs time.
How good is the JDBC driver these days (Score:3, Interesting)
Re:Question (Score:4, Informative)
Re:Question (Score:3, Informative)
Er, not really (Score:5, Informative)
No, it hasn't. [mysql.com] A summary of the list of missing features:
Of course, they give crap rationalizations for each, and/or that "it's planned for [distant version of MySQL]". Of these features, only the last might be considered trivial, and even that is quite a pain if you're trying to write some portable SQL.
The others, particularly the lack of triggers and foreign keys, make this a data integrity nightmare for anything nontrivial.
Sure, sure, "but you can do it all in code": typical response. You know, that was their response to lack of transactions, too. "Too slow", "you don't need those". Right. You could just write a whole database in your code, too. The point of using a RDBMS (and, lacking relations of any sort, makes MySQL just a DBMS) is reliability so you don't have to constantly worry about these things.
PostgreSQL has all of the above features, and quite a few more. It's an OORDBMS. (Yes, this is very cool, and lets you do some very nifty things.) It's got better-than-row-level-locking (MVCC; MySQL does table locking only.) And all the other things people have mentioned here.
MySQL is a toy database, and should be treated as such. Not just for transactions: for all the things that make a robust RDBMS.
OORDBMS? (Score:3, Interesting)
It didn't have nearly the same kind of features of true OODBs, What exactly is the use for Postgres's OOness?
Re:Er, not really (Score:2, Interesting)
Re:Er, not really (Score:4, Insightful)
I do. I really dislike having to repeatedly write code to get around the lack of features in MySQL. MySQL developers have often pointed out that there are workarounds for the missing features, however they don't talk about the impact this has on application performance, quality and development time.
Re:Er, not really (Score:2)
MySQL on the other hand(you can read the FAQ and other docs for proof on MySQL's website) has taken the approach of removing features that aren't that worth while to the "mainstream person". Rather than tell you to RTFM, here's a quote directly from the horses mouth:
1.7 How Standards-compatible Is MySQL?
This section describes how MySQL relates to the ANSI SQL standards. MySQL Server has many extensions to the ANSI SQL standards, and here you will find out what they are and how to use them. You will also find information about functionality missing from MySQL Server, and how to work around some differences.
Our goal is to not, without a very good reason, restrict MySQL Server usability for any usage. Even if we don't have the resources to do development for every possible use, we are always willing to help and offer suggestions to people who are trying to use MySQL Server in new territories.
One of our main goals with the product is to continue to work toward ANSI 99 compliancy, but without sacrificing speed or reliability. We are not afraid to add extensions to SQL or support for non-SQL features if this greatly increases the usability of MySQL Server for a big part of our users. (The new HANDLER interface in MySQL Server 4.0 is an example of this strategy. See section 6.4.2 HANDLER Syntax.)
We will continue to support transactional and non-transactional databases to satisfy both heavy web/logging usage and mission-critical 24/7 usage.
MySQL Server was designed from the start to work with medium size databases (10-100 million rows, or about 100 MB per table) on small computer systems. We will continue to extend MySQL Server to work even better with terabyte-size databases, as well as to make it possible to compile a reduced MySQL version that is more suitable for hand-held devices and embedded usage. The compact design of the MySQL server makes both of these directions possible without any conflicts in the source tree.
I don't consider MySQL a toy database, thats akin to calling Linux a toy operating system, where the real companies use AIX,Solaris, HP-UX, etc.
Damn straight! (Score:3, Insightful)
Rational and complete arguments like yours be damned.
This is your data. If it's important enough to store, it's important enough to protect. ACID is not optional.
ORDBMS, not OORDBMS (Score:2)
PostgreSQL is not OORDBMS, it ORDBMS - and that is a benefit of it. There are plenty of document on Internet explaining it from different angles.
Here [slashdot.org] is what make PostgreSQL ORDBMS different than other RDBMS.
The Third Manifesto [thethirdmanifesto.com] us the best book covering the subject.
My own experience shows, that OOP paradigm should be neither ignored or overused. Languages, like Python, help you to use OOP only when you really need it. Similar way, DBMS, like PostgreSQL, helps you to use objects in your databases only when you really need them, and according with SQL'92 standard.
OORDBMS, offenly stays for ODBMS databases, with some SQL interface extensions. Primary such systems are designed for persistence of serialized objects. Therefore they inherit all problems related to ODBMS, and first of all - lack of theoretical support (OOP is based on heuristics), lack of ad-hoc queries, lack of reflection mechanisms, very tight-coupling, lack of on-the-fly db schema changes, lack of consistent replication, and so on, and so on. In few words, it's easy to use OORDBMS as ODBMS, but you cannot use OORDBMS as RDBMS (without additional SQL-compatible transaction manager) - it's ODBMS by it's nature.
In ORDBMS PostgreSQL relations are first class objects with all theoretical support of relational algebra, while inheritance and ADT are just addons. You can use ORDBMS as RDBMS (that's the way most of use use in real life), but you cannot use it as ODBMS (without additional OR-mapping manager) - it's RDBMS by its nature.
Re:Question (Score:3, Insightful)
Re:Question (Score:2)
Re:Question (Score:5, Informative)
I'm the OpenACS project manager so want to make sure that people understand that the piece (and much of the commentary) was accurate when written, but that it was written many moons ago. However, nowadays MySQL has the InnoBase backend which provides full transaction support, and has seen other major improvements.
Our project only supports Oracle and PostgreSQL, and I still feel MySQL is lacking in many areas, but it has improved greatly in the last couple of years.
So has PostgreSQL, of course! We love it
Re:Question. I cry foul! (Score:2)
Maybe it was a troll, but here's the proper information:
- Transactions are available to MySql.
MySQL 3.23 release has several major features [mysql.com] not present in the 3.22 or 3.21 releases. These include: full-text search, replication between a master and many slaves and several new table handlers that support large files and transactions
- Is that information about foreign key [mysql.com] constraints in the MySQL manual? .. Why, yes!
Are record locks [mysql.com] really a non-existent issue? Maybe the MySql user manual can shed some light on that point: "Performing a read in share mode means that we read the latest available data, and set a shared mode lock on the rows we read."
- The stored procedures and triggers [mysql.com] are not here yet. Thank goodness something in that old link doesn't need to be refuted!
So yes, you might want to check out that really old critique of MySql, but then again you might want to look at the MySql.com website if you want current information. Then you can compare the newest PostgreSQL to the newest MySQL.
Re:Question. I cry foul! (Score:3, Informative)
What they don't tell you is if you use innodb tables for transactions, you won't be able to back up your database without shutting mysql down unless you buy the innodb hot backup tool. So yeah, they have transactions it just doesn't work well with doing backups on your data.
Postgresql has mvcc (multiversion concurrency control) meaning that readers or writers don't block other readers or writers from accessing the same data.
If you are going to start talking about vapor features then what about postgresql's plans to support point in time recoveries (pitr), redo logs, savepoints, and full clustering with multiple masters.
Incidentally, the link you point to says that stored procedures are planned for version 5 of mysql. Mysql is currently on version 3 with development work being done on version 4. Version 5 is a long time off. Triggers are something that the mysql developers will consider, and are not guaranteed to be implemented.
Getting back to what is present in the software now, mysql doesn't support stored procedures or triggers. Postgresql meanwhile supports triggers, stored procedures (written in python, perl, or sql), and rules (which allow you to intercept and rewrite sql queries).
Foul indeed... (Score:5, Insightful)
What the MySQL developers conveniently fail to mention is that if you use transaction-aware table types, performance drops dramatically. Under load with multiple concurrent connections, PostgreSQL is pretty close to the speed of MySQL or faster by default and blows MySQL's doors off when MySQL is transaction safe.
Regarding foreign key constraints, see note regarding transactions. And if you are really concerned about fk speed, you don't have to use them in PostgreSQL either.
Record locks hunh? It may surprise you to know that as a user, you don't need to explicitly tell PostgreSQL to lock tables with your queries. Ever. This a relational design issue. This should be handled by your database architect when they layout the table structure, rules, foreign keys, views, and triggers. You do have someone that designs the table structure ahead of time right? Sure you do. But why don't you have to explicitly lock the tables is PostgreSQL?
Maybe it's because PostgreSQL is smart enough to know when you need them without your help.
Transactions? Aren't those only for banks and e-commerce? Nope. Let's say you want to update all the users in Slashdot to give all of those loyal geeks one extra karma point. So you select on all users, grab their current karma, add one, and update the record. This has two problems: concurrency and completion. What happens if the user is moderated up or down in between the moment that the record is selected and the moment it's updated? Looks like the user has accidentally been given either (a) an extra point or (b) had a point taken away. Also look at what happens if the database goes down while doing the work (someone kicked a cord), who got the extra point and who didn't? Darn. Wish I had transactions...
So you use the transaction-aware MySQL tables. Wow! Performance has sure dropped out and we have to think about implementation details like locks. I sure wish there was a way to avoid stupid programming mistakes like forgetting a lock. Well...you could use just about any other database out there (including PostgreSQL).
As for stored procedures and triggers, you need not talk about features that aren't here *yet*. Version 4 isn't out of beta yet and you're hanging on a possible v5 feature? While we're at it, let's talk about how multi-master replication will appear in PostgreSQL by then. And didn't you hear? Microsoft's IIS will have its security holes patched up in two years too. Vaporware is vaporware. Believe it when you can download it.
------
Now then, on to personal gripes about MySQL above and beyond the ones I have listed above.
Benchmarks: On MySQL's benchmark page comparing PostgreSQL [mysql.com], they complain that no utilities are available for benchmarking but their own. This is not strictly true. No benchmark can be made because the syntax to the different RDBMSs are so dissimilar that none can be made currently without a strong bias. Stored procedure support, for example, would definitely skew results away from MySQL. But that wouldn't be fair for a benchmarking tool since MySQL doesn't support stored procedures. The same is true of triggers, rules, views, and other such "unimportant" features.
Of course MySQL's benchmark shows MySQL in a good light. They use only the feature set of MySQL to perform the benchmark.
They also mention on the page that they've contacted the PostgreSQL developers for tuning information and methods of improving the benchmark tool. I cannot express loudly enough that THIS IS A LIE! The PostgreSQL mailing list has many instances of developers reporting that they (a) never heard about this "contact" until someone pointed out the MySQL page, and (b) they have been ignored when they've tried to submit tuning techniques and other optimizations. Sounds like some people don't want their benchmarks to give the "wrong" results. Heaven forbid!
As it stands now, the benchmark is a year and a half old. MySQL is on its 53rd patch revision and PostgreSQL is two minor version releases later since this benchmark was released. Weren't you saying something about posting stale information? They still have a page complaining about vacuum bugs and the desire for a newer version of PostgreSQL that fixes the problem.
Feature comparisons: another source of info [mysql.com], it talks about the query speed on mostly read only data. Did someone forget to mention that flat files are even faster for mostly read only data?
It states that since MySQL has more users, it must be better than PostgreSQL. Funny how that logic doesn't seem to work for Windows. They use the same logic with the number of books. It wouldn't surprise me if there were more books on DOS than Linux. Does that make DOS better? Does that say anything about the relative quality of those books? No.
MySQL supports more APIs and languages. This is correct unless you want to count stored procedure languages. Oh wait, MySQL doesn't support stored procedures. (Yet! They'll be there in two or three years or so.
It then touts MySQL's fine replication facilities. Hello people! How often has slashdot gone down due to database issues? Hardly a poster child for stability or reliability.
According to mysql.com, PostgreSQL doesn't have a unit test/regression test. It makes one wonder if they've even used PostgreSQL.
PostgreSQL is said to be deficient with ODBC. Too bad they couldn't provide any specifics.
I'll relax about the statement that MySQL had more functionality with ALTER TABLE. FYI for readers, that has just changed with PostgreSQL 7.3.
They are correct that PostgreSQL doesn't have MERGE. Instead, they use the SQL92 standard UNION. Does the same thing. And let's not forget about views. What was that!? MySQL has extensive use of non-standard syntax? Any queries you write in MySQL will only have a prayer of working on MySQL? Say it ain't so!
PostgreSQL has had full text search for a while as part of contrib.
I don't even want to start with "MySQL Server is coded from the start to be multi-threaded, while PostgreSQL uses processes." Aside from databases on Windows, this helps whom significantly? A clue folks: Apache HTTPd also uses processes extensively. Pure thread support was only really added for the sake of Windows. This is one of those times where stability and consistency are more important than raw speed. This is your data!
And on and on...
As a final note, I would like everyone to take a trip down memory lane with me and recall that the MySQL dev team didn't see a need for MySQL to have transactions or any other of those "fancy" things at all until a couple of years ago -- when everyone started to realize that MySQL wasn't really twice as fast as PostgreSQL even though MySQL was crippled feature-wise.
The MySQL has so much misleading information (apart from the items that are outright false) on the web site, I wouldn't recommend it to anyone who wants correct information, "current" or otherwise.
Re:Foul indeed... (Score:2)
I stand corrected (Score:4, Interesting)
Going to add and drop a temporary column?
With PostgreSQL (and any other ACID database), that same SQL you wrote is atomic. It either works completely or not at all. No special keywords. No extra steps. It just works.
When it's that easy in PostgreSQL, why would you use MySQL? Note that this is a write operation; Don't assume that MySQL is faster.
Comment removed (Score:4, Interesting)
Re:I stand corrected (Score:4, Interesting)
Simpler? When you need to get a job done, you either have a simple database or a simple app. The amount of logic is the same.
If Joe Newbie doesn't need views, Joe Newbie doesn't have to use views.
On the other hand, Joe Newbie shouldn't need to learn about explicit locks, database integrity issues, workarounds because a feature isn't there, etc.
pg_dump is indeed required whenever a minor or major version change happens. That happens once a year or so. It's not like it happens once a week. And of course, that assumes that you upgrade according to PostgreSQL's release schedule. Why you would do that, I have no idea. More likely, you are upgrading/replacing the database box so you would have to dump the data no matter what software you were using.
If the version and hardware configuration are working well, why would you change anything (other than apply patches) by default?
As far as cheap hosting, that's fine. If the hosting company I have to work with has IIS, I'll be using asp won't I? An abundant option isn't necessarily better. It's just more abundant. Going from computer to computer, you're more likely to find Windows 98 than any other operating system. Does that mean it's better? Indeed, sometimes you have to use suboptimal tools to get the job done. This doesn't mean that you have to seek those suboptimal tools out.
If your data doesn't matter as much to you, it doesn't much matter what solution you choose or from whom you get your hosting. If you value your data, why not show it?
If you're hosting your own database machine -- not exactly a rare occurance -- and PostgreSQL and MySQL (and SAP DB and Firebird) cost the same, why on Earth would you choose MySQL?
MySQL is NOT easier to install in my experience. So why choose MySQL?
MySQL is less feature-rich. So why choose MySQL?
MySQL is not significantly faster. Is this why you choose MySQL?
MySQL cannot enforce data integrity.
Need I go on? If crappy hosting is MySQL's only ace in the hole, it's in more dire straights than I had originally thought. As far as I see, the biggest reason to stick with MySQL is that if you've spent too much development time with it (written app logic that the database sould've already handled), it would be too much trouble to switch.
Are you saying slashdot is well run? (Score:2)
MySQL was used for the US census's website, not for their central purpose. I would be very suppressed if they were actually storing the real data in a MySQL database.
And again, MySQL was used for a small part of Yahoo (the finance stuff) not for storing their link catalog.
Re:Are you saying slashdot is well run? (Score:2)
Maybe if... (Score:5, Funny)
HAR HAR HAR...just jokin' around...pleeeeze don't kill me.....
Re:Question (Score:4, Insightful)
In my experience with database applications, anything under 100,000 records is considered a small database. I have to admit in the last year or two my firsthand experience with mySQL has been limited, but from what I see in the current feature set there are situations where PostgreSQL is the definite superior choice.
Sure, MySQL can handle a lot of records and is quite stable and lightweight, however the lack of such basic features as foreign key constraints and restrictions such as table-level-only locking limit its usefulness as an "Oracle killer".
Yes, MySQL can do SELECTs from million-plus record tables, do lots of inserts per second etc etc in all the benchmarks, but what happens when you have 100,000s to millions of records and dozens to hunderds (maybe thousands?) of concurrent users who all frequently write to and delete from the database in addition to doing SELECTs. mySQL falls apart because all the users have to wait in line to write to a given table because the whole damn thing gets locked out until the first user to open a write transaction hasn't finished yet.
A large database also adds challenges to maintaining referential integrity. If foreign keys were so expendable that they could be eliminated (functionality put in the application) to boost performance, why does such functionality remain in Oracle MSSQL and others? Maybe because if it is done in the database (and done right--solid and stable) you don't have to trust your data integrity to application code. You don't want to deal with orphaned records when you have 45 tables and 2.5 million records to manage, just because some flunky Java programmer didn't cover all the bases in a class buried somewhere in a big enterprise web app. Foreign keys allow for an extra layer of protection for important data--if a database constraint is violated by an application bug it'll sure get noticed faster.
These are but two examples where PostgreSQL has the edge (even if it can't top out some arcane benchmark). Given that, mySQL is still very useful--and it doesn't have to be limited to "toy apps". Slashdot can use mySQL quite well, thank you very much. It is certainly NOT a "toy app", and mySQL's performance can handle all the slashdotting thrown at it, as far as retrieving data goes. Keep in mind though, that Slashdot data is fairly static. Its database is read far more often than it is updated/inserted/deleted (even given how many comments and articles are posted and with moderation). The relationships between tables are simple enough that referential integrity is manageable through application code, and above all, the data is not THAT mission critical (if a comment or 12 disappear from Slashdot, the lights will stay on and planes will not fall out of the sky). Speed and compactness are primary for Slashdot, the rest is secondary, and mySQL can fit the bill. If I need something to handle payroll, or health records or whatever--I thing PostgreSQL has reached the point where I find it the more trustworthy of the two with data of that nature.
While PostgreSQL vs mySQL can ignite a virtual Jihad, it should come down to this--pick the right tool for the right job (not just features and performance, but also personal preferences--what tools are you most comfortable with, etc etc).
Re:Question (Score:2)
I'll add that, for all open-source databases do a great job, there will always be a market for the 800 lb. gorillas like Oracle and DB2.
There are some high performance features of these proprietary applications that, I daresay, will never trickle into the Open Source world.
Re:Question (Score:3, Funny)
Oh yes you are.. (Score:2, Interesting)
Re:Im not trolling but..... (Score:4, Insightful)
PostgreSQL can handle the 50 million rows provided the data structures are well-designed, and according to their press release they can handle the replication (it's always dynamic). The query rate of 2000/sec is more a question of the server hardware, server configuration, and network infrastructure than the database software per se. I don't know about "complex 3D boolean queries" but I know for a fact that PortgreSQL can process big, ugly, inefficient queries pretty well.
What makes M$SQLServer and Oracle more "suitable" for enterprises is their add-on tools (both have loads, though of varying quality) and the fact they maintain service centers for when the DBA throws up his hands and gives up. From my perspective though, the reduced licensing costs (even for large installations, we're talking about hundreds of $'s times thousands of users!) could pay for a lot of up-front hardware and ongoing code review. If I were starting a largish e-commerce project today, I'd start on Open Source just because or the reduced up front cost. You don't become among the richest people in the world by giving anyone a good deal.
Re:Im not trolling but..... (Score:2)
Redhat will quite happily sell you a version of Postgres that they then support. For a price, of course, but a shitload cheaper than either Oracle or DB2.
Dave
Re:Im not trolling but..... (Score:5, Informative)
If mysql is 'borking' at anything over 8000 rows, I'd take a real hard look at my design if I were you. I did a conceptual demo for a client once, where we sucked up a raw data file from their mainframe - 65000 rows, five tables, and the largest table had about 18 columns. The import took all of 45 seconds, and there was absolutely no performance problems of any kind. This was being assessed to determine how much faster this would have been compared to a RAD-based solution they were currently using. But 65,000 rows is small potatoes.
Re:Im not trolling but..... (Score:3, Funny)
We tried to arrange for some time on a massive beowulf cluster equipped with a 3 TB RAID and several GB of memory installed so that we could test against 1000000000 records and 52.7 tables, but they were booked solid.
Needless to say, I can assure you that based on the client's needs, the test I outlined (as inconsequential as it may seem), was quite appropriate.
Re:Im not trolling but..... (Score:2)
And just b/c MySQL might be the right tool for a given job doesn't mean that job isn't "REAL WORK". Kinda like the whole Linux/Windows debate...it's all about suiting the app/OS/whatever to the given task. And MySQL performs very well for tasks that have lightweight database needs.
Re:Shocking arrogance (Score:5, Insightful)
Seriously, look at the amount of Oracle installations out there. Now how many of them _need_ any of those features? Is it worth the extra cost of Oracle? More than likely it's all some marketing crap that eveyrone is led to believe than "only Oracle can do this".
My PHB is like this. He insists we use Oracle because we need an "industrial strength database", for a db with 40,000 records. Argh! Oracle is freaking expensive, we got Larry Ellison crusing around in some damn yacht race on our bill. In our case, Postgre would be an Oracle-killer, it's just getting people past that fact that Oracle is unnecessary for alot of applications.
Re:Shocking arrogance (Score:2, Funny)
FWIW, I once fixed up a company hopelessly wedded
to Oracle by essentially replacing all their
reporting systems by just:
The end result ran under 10 minutes, while the old
crap took overnight.
My motto has always been, get the sh*t out of
the fabled "DB" as soon as you can. Then you
can use awk/python/perl whatever to actually
do something useful with it.
Re:Shocking arrogance (Score:4, Informative)
With the exception of wordprocessing all of the innovations you cite were developed by academic R&D teams, NOT by commercial software vendors.
This one exception, wordprocessing was NOT an innovation arising from the computer revolution - it's roots go back to IBM Selectric Magcard typewriters.
All the commercial vendors have done is copy, copy and copy.
Citations:
GUI - Stanford Research Institute Augmentation Center
Wordprocessing - IBM Typewriter Division
3D graphics - Evans and Sutherland, UofUtah and Harvard
Webserving - T. Berners Lee, CERN
The fact is that if the closed source behemouths were to dry up and blow away, it would probably enhance innovation by reducing the barriers to entry in the marketplace imposed by the likes of Microsoft.
After all, what VC is going to fund a new wordprocessor these days? VC's know all to well what Microsoft would do to any new market entrant that starts to gain traction. They have the horrible example of Netscape to look back on.
Grammar and spelling (Score:2)
Mistakes happen, and flaming someone for making an honest mistake is inappropriate. Pointing out the mistake hurts no one. It presents the opportunity to avoid the mistake in the future and allow someone to become a more effective writer. If you choose to ignore the correction, that's your prerogative.
As a point of fact, bad spelling and grammar hurt non-native and dyslexic readers much more than native readers. Also, I find that non-native speakers tend to demonstrate much better skills in grammar than most Americans.
(Making sure I stay at least slightly on topic...)
MySQL doesn't care about spelling and grammar as much (No foreign keys, etc.). The lazy like that about it. PostgreSQL can be made a bit more anal retentive about your data.
At the end of the day, if the same person who wrote it into MySQL has to read it back, it works fine. PostgreSQL enforces the rules so that anyone -- not just the original author -- can read it back with perfect comprehension.
Re:Shocking arrogance (Score:3, Informative)
We chose PG because it had 90% of what Oracle had and less the fat. Postgresql is far easier to get running and far better on the memory footprint, it runs in around 8mb's... big whoop. If you know anything about Oracle, its hardly good about memory, and one bitch of a product to get running (right).
Lastly, I'll say this about Postgres, its in our opinion, and this is from 20 years of experience with Oracle (I go back to the Oracle 6.24 days when I worked for Prime Computer and ported Oracle to the 50 Series machines for Prime), that Postgres is much more stable out of the box on Linux than Oracle could ever be, Oracle is as buggy as it gets, and don't let Larry fool you. Its got bugs.
As far as this dude throwing shit at open source and saying that the commercial counterpart is better? Possibly, on the desktop you might be on to something, but I firmly believe that you CAN'T beat PHP, Apache and Postgresql as an application platform for 99% of the Web world out there. The three products in question that I mentioned are far better products than ANYTHING on the commercial market right now... And yes, they are Open Source.
Re:Shocking arrogance (Score:2)
Re:Warning (Score:4, Insightful)
In fact, if you want to you can run PostgreSQL on Windows if receiving less security advisories is more important than the time-to-fix. Or if you feel really paranoid, just run PostgreSQL on OpenBSD. That gives you an excellent safety record, with only 1 remotely exploitable security problem in nearly 6 year.
For a complete list of supported platforms see http://developer.postgresql.org/docs/postgres/sup
Re:had to be said (Score:2)
Re:Go on then. (Score:5, Informative)
Well, if you insist... :-)
It's better for certain things (most things, actually). PostgreSQL is a bit more feature-complete as a SQL database than MySQL is. MySQL is improving, certainly: it now has transactions and such. But PostgreSQL has quite a bit more: triggers, rules, stored procedures, and views, for instance.
In terms of speed, MySQL is faster for certain specific operations but that speed comes at the price of database integrity: the lack of rules and triggers means that it is not possible for the database to enforce consistency between tables. One must thus trust applications to do the right thing, which is generally not wise.
It's like the difference between an OS with memory protection and one without. The one without may be faster for certain things, since the OS doesn't have to worry about messing with page tables and dealing with page faults of various kinds, but the price is that you now have to trust the applications running under the OS to do the right thing and not touch memory that doesn't belong to them.
As I said, MySQL is faster for certain things. But PostgreSQL is reportedly [phpbuilder.com] better at handling lots of concurrent transactions than MySQL. It's not clear, then, that MySQL is much better than PostgreSQL, if at all, under high load situations. And if it isn't, then there's really little reason to go with it over PostgreSQL.
Finally, even if MySQL is faster, it's not likely to be so much faster that it is the difference between success and failure. And I can tell you this: experience shows that the initial requirements of a project are often vastly different, and usually much less demanding, than the final requirements for the same project. So it makes more sense to go with the most capable database backend you can lay your hands on, as long as it remains within your budget (your real budget: remember that you're likely to spend a lot more money than you expected, if only because the requirements will change over time). That means going with PostgreSQL over MySQL, if given the choice. You have to make the decision early because changing your database engine mid-project is extremely difficult, especially if your code was written to work around the limitations of the database engine, as it almost certainly will if you're using MySQL.
These days I don't think the question should be whether you should go with PostgreSQL instead of MySQL. It should be whether you should go with MySQL instead of PostgreSQL. PostgreSQL should be the default choice these days, because it is so much more capable at the same price.
Re:Go on then. (Score:4, Informative)
Now, everyone joins the VP-MKTG's bandwagon and wants their new reports compiled and summarized that way. In MySQL, without support for views, every query ends up having to be constructed again, including the tortured logic involved in having no sub-selects or unions. With view support, all we need to do is toss that awful query into a view, and select out of the view. It's not gorgeous, but it works. And you can even hand off the view to the other developers, so they don't get stuck in the quicksand of recreating the logic from scratch.
And now, because PostgreSQL supports functions that return datasets, we can toss all that logic into a function, and call that instead.
So, in answer to the question of what can PostgreSQL do that MySQL can't do: unions, subselects, views, functions. All are time savers. Lacking them, we can devise work arounds, but having them is very, very nice.
Re:table (record) based functions (Score:3, Informative)
SELECT * FROM function()...
Re:table (record) based functions (Score:2)
I always thought this was the coolest thing ever in a database. Now postgres has given you another tool in functions which return recordsets.
Re:unicode support and proper collation (Score:3, Informative)
The beauty was that the java code would automatically convert the original Big5/JIS/other encodings to UTF8 first, and then JDBC would store the unicode into postgresql.
Re:unicode support and proper collation (Score:2)
I would just imaging that the characters are sorted by their unicode sequences, just like ascii characters are sorted by their ascii sequence.
If you are refering to manually sorting the data for speed, my project was pretty simple, so I didn't and don't really know how.
What type of of application are you building that needs unicode?
Cheers
Re:online backup? (Score:2, Informative)
pg_dump, which is by far the ONLY way i'd want to back up. Not only does it dump your data, but it dumps your tables, views, stored proc's, etc. And to re-recreate your database, you simply import the script...
Now if your talking replication? Thats a different story.
Not exactly... (Score:2)
But its entirely possible I just don't know what I'm doing. In any event, it seemed to work fine.
Re:DAMNIT!!! (Score:2)
BWP
Re:Question for you all... (Score:3, Insightful)
As far as strictly data engine features go, Oracle has:
materialized views (which can increase performance)
point-in-time recovery
data partitioning
more flexible backup and restore options
the ability to use Win NT passwords and security (I know, that's not a big issue for most)
PostgreSQL does have some support from third-party software. phpPgAdmin [sourceforge.net] for example, is a great tool and gets better with each release. pgAccess [pgaccess.org] is a tool that comes with PostgreSQL, but I haven't used it much in the last year or so, and I remember it feeling like it was not quite ready for prime time. But it's a Windoze front-end for the PostgreSQL server and that's a big deal! There are also a couple of books about it (with more on the way, I hope), one of which, Practical PostgreSQL [commandprompt.com], published by O'Reilly is very good and available online.
The biggest thing you get for all the money you spend on Oracle is a "known" product. There are hundreds of books on Oracle (many are awful--caveat emptor) as well as classes and trainers and consultants and DBA's everywhere in the world (repeat caution above).
I love PostgreSQL, enjoy working with it, and am delighted with the new functionality the developers chose to include in version 7.3 (almost like they read my mind). Face it, for most medium-sized projects, we create a connection to the database (I often use ODBC) and start firing off queries. It doesn't matter to our program which database is behind the connection. We want speed, efficiency, and safety for our data. Anything more is window dressing (or comfort for the suits). Long live PostgreSQL!
Oops, I'm going to get down-modded for editorializing... *sigh*