I haven't used postgres for several years, and in that time I've clearly managed to forget it's huge number of annoyances and quirks.
I think that using MySQL, and either mysql-query-browser or Tora has spoiled me a bit, as using Postgres 7.4 (as shipped with debian stable, ubuntu, fedora, etc) is like stepping back 10 years.
Setting up is arcane, admittedly the packagers for the linux distro's are partly to blame for not making it easy - but, crikey, why the heck do I need to create databases before I can even log in, and I have to su to postgres to do so as there is no standard user, and I have to muck about with several configuration files just to bloody access it on localhost
The syntax is archaic and inconsistent and the manuals are lacked worked examples - the mysql docs are much clearer and nicer
MySQL and SQL Server have left me expecting things to JustWork and not require hours of tinkering before being able to run queries.
Yes, I'm sure it gets easier once you've done it for a while, but porting from mysql, which I am familiar with - and never had these troubles with to postgres sucks eggs through a straw
update: attempting to allow a webapplication user multiple permissions to all tables, sequences, etc in a single database doesn't seem to be possible - in MySQL I just grant [list of privs] on dbname.* to user, etc - in postgres I have to list the dozens of tables and associated sequences - this is incredibly tedious. Hateful thing.
Re:agreed, setup is a pain
Phred on 2006-03-02T19:15:53
I agree that installation is one of PG's weak areas, and I think part of the reason here is the way it's packaged on many distros. On Gentoo Linux, I can run 'emerge postgresql', followed by 'ebuild postgresql-8.1.3.ebuild config' and it takes care of creating a postgres user, creating a postgres database, and initializing the database. Doing this process manually (which is the case for many distributions) is tedious and probably turns off some users. If you have a reasonable sized database you'll also need to set the kernel shared memory max (kernel.shmmax).
Mysql is admittedly easier to get going with. On most rpm based distributions I just type 'rpm -ivh mysql...rpm', then 'mysql' and I'm off to the races.
I've had pretty good luck with the PG documentation though, and whenever I can't find something there I pop onto #postgresql on irc.freenode.net and I can get questions answered right away. Maybe that's because I'm more familiar with it though.
Re:agreed, setup is a pain
Dom2 on 2006-03-02T19:20:55
I've heard a lot of people say that Pg is hard to set up, and I just don't get it. I've used the Debian package install and the RPM package on RedHat and in both cases, it was just a question of "start server, create user, create database". Piece of cake.-Dom
Re:agreed, setup is a pain
perrin on 2006-03-02T19:36:57
The details of "create user, create database" are more complex than they are for MySQL. As Phred pointed out, he has a script to do it on Gentoo. The last Red Hat RPM of it that I tried required me to dig up some RPM-specific docs and edit a text file.
\h
.In summary, "Wah -- it's different to my comfy usualness!" from both of us.
Anyway, to address some of your points:
sudo -u postgres createuser -ad $LOGNAME
. That'll give you your own superuser account and you won't have to use su at all.Re:Wow, the venom!
TeeJay on 2006-03-02T20:01:42
MySQL is WAY easier to install - configure, make, make install - no creating and su'ing to a special user to create the databases.
"Why is the command line interface so appalingly bad? The help is non-existent on every instance I've connected to. psql at least gives you \h."
myql allows you to switch, and show databases, list and describe tables and best of all quit is quit and help is help. Table names and fields are tab completed. Postgresql is grumpy and unhelpful compared. The source command allows you to run sql scripts without exiting and piping. The SQL Prompt is far easier and more powerful than psql.
"Why the heck am I allowed to connect without being attached to a database? What on earth purpose does it serve? It's just confusing."
It's not confusing - it's common sense, logging into 1 database to create another database or using command line scripts is confusing, as is describing users or add users that have nothing to do with the database you logged into.
"Why is the documentation for MySQL so bad? It's full of random gibberish about previous versions that I don't use and don't care about. It rarely seems to get to the point. In contrast with the PostgreSQL documentation, which I find clear and to the point."
In an alternative universe perhaps - the Manuals for 4.x and 5.x are seperate, and it's not uncommon to have to deal with databases on multiple versions, you can also access the manuals specific to a version. There isn't any gibberish in there and the examples and syntax are clearer than postgres. Of course thats subjective but hey.
Postgres documentation worked examples are a bit sparse, on the whole I find MySQL's better again subjective.
pgAdmin and pgAccess failed to compile and don't come anywhere near SQL Server, MySQL or Toad/Tora.
On the whole its arcane and unpolished - the fact we have to use a heath-robinson contraption like slony for a core job of replication is pretty worrying, ditto the lack of a built in full text index, not to mention pgdump not working between versions.
I'm sure that I'll get used to it once I've been bitten a few dozen times, but after using MySQL, Oracle and SQL Server it is truly a step back in time.Re:Wow, the venom!
Phred on 2006-03-02T20:33:52
You can solve the pg_dump issue by grabbing the pg_dump from any 8.1.x version. It's been refactored to address the issue of not working between different versions.
Slony is actually a robust replication mechanism for what it's worth. It doesn't handle schema updates all that well, but I don't think many replication systems do handle that well.
There is at least one full text indexing system in the contrib tree with the source.
Re:Wow, the venom!
Dom2 on 2006-03-02T20:37:32
"myql allows you to switch, and show databases, list and describe tables and best of all quit is quit and help is help."Just like psql, apart from quit/help.
"Table names and fields are tab completed."
Maybe in your version. For me, psql completes, mysql doesn't. And it gets ^W wrong to add insult to injury.
"The source command allows you to run sql scripts without exiting and piping."
In psql it's spelled
\i
. Try\?
for some help on the psql commands."The SQL Prompt is far easier and more powerful than psql."
No, they're pretty similar, but you're more used to one than the other.
"It's not confusing - it's common sense, logging into 1 database to create another database or using command line scripts is confusing"
You're missing the point here. It's confusing because it's not what you're used to. I find MySQL confusing for exactly the same reason.
As regards the manuals, I would like to point out this example: TIMESTAMP Properties as of MySQL 4.1. It's laughable -- why is the 5.0 manual concerned with 4.1? And why are the properties so baroque anyway?
I agree -- the PostgreSQL manuals do have sparser examples. But that wasn't your original claim. Personally, I find them sufficient.
I'm sorry that you didn't manage to compile the packages. So how do you know that they are inferior? I'm curious to know...
As to pg_dump, that works fine between versions. I believe that the recommendation is to use the newest available version of pg_dump. What problems did you have?
As to full text search not being built in; well it's in contrib, which is easily installed if you're using a package. It's a shame it's not installed by default though.
I personally dislike Slony as well. OTOH, I've rarely needed replication, so I don't have enough experience of that. Again, it would be nice to get something easy to use installed by default.
"Arcane and unpolished" I find particularly amusing, because that describes my impressions of MySQL almost perfectly! Doubtless I will get used to it over time, but being introduced to it for the first time is really jarring.
Re:Wow, the venom!
vek on 2006-03-03T00:35:44
he last time I looked at PostgreSQL, I liked what I saw but the lack of reliable out-of-the-box replication was a showstopper. I was quite surprised that PostgreSQL was lagging behind MySQL & Oracle in that area. PostgreSQL for me therefore is fine for simple apps on a single database host, but once you move into something a little more advanced with multiple redundant database hosts sitting behind a load balancer, replication is a must have feature.
I just had a quick peek at the online documentation for Pg 8.1 and didn't see anything related to replication as a core functon so it would appear PostgreSQL hasn't caught up with MySQL & Oracle in that arena yet. Admittedly, I don't follow PostgreSQL development so have no idea if replication is in the works for a future version.Re:Wow, the venom!
TeeJay on 2006-03-03T13:20:22
I have used pgAdmin on other people's machines, it's slower, ugly and contains less features than the equivilent tools for Oracle (Toad/Tora), MySQL (mysql-query-browser, mysq-admin) and SQL Server. PGaccess runs but lacks most of the features I'd want.
Trying Squirrel, I found that it can't find the jdbc classes for anything and is slow, ugly and clunky - but thats Java's fault rather than Postgres:) Re:Wow, the venom!
Dom2 on 2006-03-02T20:49:16
I forgot my favourite bit of MySQL irritation: DBD::mysql doesn't support UTF-8. How long is it since Perl 5.6 came out now?-Dom
Re:Yay! Relgious war!
TeeJay on 2006-03-03T11:11:11
Actually I haven't found MySQL hurts you on a day to day basis and neither have the guys at google, who looked at porting to postgres and decided (wisely) IMHO to stick with mySQL.
I've found Postgres much more painful, and not just for setting up - I have to write my own bloody cast functions to convert boolean to int, I have dozens of small little queries utilising the ease of MySQL in the application I'm porting and find that each one requires a great deal of mucking about to replicate in postgres.
Postgres does have some strengths - user defined functions, user defined casts, and, importantly, robust and effecient transactions, constraints, subselects and stored procedures.
Of course the projects I'm currently using postgres for - utilise none of those features and would be much quicker and easier in MySQL.
Re:Yay! Relgious war!
TeeJay on 2006-03-03T11:19:10
And of course - just to make life interesting - I can't just use an int in postgres I have to use int2, int4, int8 etc.. how annoying - why not go the whole hog and have char8, char9, char10 gaah! I find this especially hateful when I have to write a function to build a cast from just to be able to treat boolean results as either 0 or 1.Re:Yay! Relgious war!
Dom2 on 2006-03-03T12:52:21
Yes, you can just use an integer. It really does just work as expected:% psql test
test=# create table foo (bar integer);
test=# \d foo
Table "public.foo"
Column | Type | Modifiers
-------+---------+-----------
bar | integer |And why are you casting from boolean to integer anyway. Is this down to the fact that you've assumed integers instead of booleans everywhere in your code because you're used to MySQL (which AFAIK didn't have proper boolean columns for a long while)? And more to the point, why on earth are you having to do this? As far as I can see it only matters if you have set the pg_bool_tf flag inside your
$dbh
. Which seems surprising to me.-Dom
Re:Yay! Relgious war!
TeeJay on 2006-03-03T13:15:29
I am using aggregation (MIN,COUNT) on the results of an IF, which always returns boolean. Postgres doesn't let you do that without writing a function and using it in a user-defined cast - MySQL DWIM, in fact that's the thing about MySQL - it may not always do STRICTLY the right thing, but 99.99% of the time it DWIM, and that is a whole lot more useful.