8

I used to develop everything with mysql, this week an opportunity to work with postgresql appeared, why not!

I was always told that postgresql had a much bigger feature set.
I read some wikis, but most of the info are really outdated.

What are the best features I was missing? Like partial indexes, etc..
Also, I will miss something from mysql?

0

5 Answers 5

20
Sign up to request clarification or add additional context in comments.

9 Comments

It would be really nice/helpful if you could talk a little bit about why you like "index on expression", "user defined aggregates", "richer datatypes", "array support", etc.. and how you've used those in the past
I"m not a fan of the functional dependency when grouping on the PK. MySQL has a similar feature and I wish no DB vendor implemented it. Far better to be explicit about how it is choosing the other fields not referenced in Group By clause even if the Group By column is a PK.
@Thomas: MySQL doesn't check anything, that's not the same as functional dependency on the primary key. Just download an alfa release of 9.1 and see the difference between both implementations.
@MichaelBuen: excellent list! You could add DOMAINs ; extremely useful wrt constraint minimisation. (and standard, as opposed to UDTs)
Add LATERAL JOIN to the list.
|
7

And don't forget the DDL, it's also transaction safe:

BEGIN;
  ALTER TABLE foo DROP COLUMN bar;
  ALTER TABLE foo ADD COLUMN baz INET;
COMMIT;

Great for maintenance work, you will always have a consistent database, even when you lose the database connection or the server goes down.

Comments

7

In addition to Michael's list (of which I like windowing functions the most)

  • check constraints
  • table functions (functions that can be used in like this select * from my_func(42)
  • partial index (CREATE INDEX idx1 ON some_table (some_column) WHERE some_flag = true)
  • division by zero is an error
  • delete from some_table where 42 is considered an error and doesn't delete the whole table
  • you can have a subquery in an UPDATE or DELETE that selects from the same table as you are updating
  • much smarter query optimizer
  • deferrable constraints (seldomly used, but when you need them, they are really helpful)
  • foreign keys are evaluated for the whole statement not row by row
  • full text search and spatial extensions on transactional tables
  • EXCEPT

2 Comments

The check constraints are extremely useful. I think MINUS is in oracle, it's EXCEPT in postgresql.
@Arthur: Thanks, you are right. EXCEPT is the standard and that's what PG uses.
3

Here's a link that lists out the difference in features between many of the major database products:

Comparison of different SQL implementations

Comments

2

FULL OUTER JOINs. The lack of these is one of my biggest complaints about MySQL. But Postgresql supports them.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.