top | item 18043425

Postgres 11 – A First Look

390 points| samaysharma | 7 years ago |craigkerstiens.com | reply

188 comments

order
[+] nathan_f77|7 years ago|reply
> Fear column addition no more

This section was really surprising to read! I use the strong_migrations [1] gem to catch "NOT NULL column with a default value", because it's such a common mistake.

I guess I had assumed that this was just something we had to accept, based on decades of architecture decisions, and the way that Postgres was written. It never occurred to me that it was actually possible to change the default behavior of Postgres and fix the underlying issue.

[1] https://github.com/ankane/strong_migrations#adding-a-column-...

[+] booleanbetrayal|7 years ago|reply
This feature has me way more excited than I probably should be. Been splitting up relatively simple schema migrations into multiple steps for years now, and definitely welcoming this change.
[+] jorams|7 years ago|reply
> Now you can quit Postgres by simply typing quit or exit. Previously you had to use Ctrl + D or \q

While this is good to help out beginners a bit, people should really learn Ctrl + D. It works practically everywhere and saves tons of time guessing/remembering and even typing the correct incantation for the program you want to exit.

[+] craigkerstiens|7 years ago|reply
Original author here.

Yes, it's great to learn Ctrl + D.

But losing out on beginners that aren't familiar in favor of things that are naturally intuitive is a great way to make those who are new to programming and especially databases feel like they're dumb or not capable of it. I still recall the first time I was in vi and I couldn't figure out how to get out of the damn thing, and don't get me started on arrow keys. There are a lot of ways to help others learn things like Ctrl + D, an even better experience might be a 1 second delay with a message informing them of other ways.

We could bikeshed all day on which is the more pristine way to exit a program, paint the shed whatever color you want, being intuitive for beginners is never a bad thing.

[+] barrkel|7 years ago|reply
C-d is a great way to accidentally exit more than one shell with remote latency. I only use it then there's no other choice. Most frequent use case is ad-hoc file transfer via terminal paste to remote end running cat > out.txt.
[+] tudelo|7 years ago|reply
Yet, principle of least surprise. What is more surprising, Ctrl+D working or quit/exit not working? Maybe I am an outlier but I would try exit/quit/bye first.
[+] lkbm|7 years ago|reply
I'd propose that "quit" should do two things:

1. Print "You can also quit using Ctrl + D"

2. Quit.

But I also believe that only doing step 2 is better than neither. psql should prioritize psql's usability over educating users on Unix standards.

[+] t0mbstone|7 years ago|reply
Control+C is used to kill a process with the signal SIGINT, and can be intercepted by a program so it can clean its self up before exiting, or not exit at all. ... Ctrl+D means end of file. It has no effect if the program isn't reading input from the terminal. Ctrl+C means “interrupt”, i.e., stop what you're doing.
[+] peteretep|7 years ago|reply
What does Python do these days? I seem to remember it would catch common cases, but rather than quit, scold you and tell you how you should be doing it the other way, which seemed like the most Western European approach imaginable.
[+] pkulak|7 years ago|reply
You're wrong. I think the bike shed should be blue.

;)

[+] threeseed|7 years ago|reply
What other apps use Ctrl+D ? I can't think of a single one.
[+] paulddraper|7 years ago|reply
Oh no!

I used to be able to Ctrl+C knowing that it would interrupt any currently running query but never lose my session.

If I want to quit the PostgreSQL shell, I'd Ctrl+D like any other shell.

What will I do now?

[+] kstrauser|7 years ago|reply
A million things like this are why PostgreSQL is the only relational database I consider for, well, pretty much anything. Their approach of “build it safe and then make it fast” has been paying off in spades for a couple of decades now. Thanks for everything you do, psql maintainers!
[+] mrep|7 years ago|reply
100% naive question: why is mysql and their similars so popular then?

Spanner and AWS Aurora base off of more mysql than postregsql from what I can tell. Why?

[+] alecco|7 years ago|reply
> “build it safe and then make it fast”

I have a lot of respect for the PostgreSQL team. But I think they don't care about the second part, or the constraints of the first part make it impossible. A simple example, the performance of a simple un-indexed DISTINCT on a single string column on a single table, is still quite bad for millions of rows.

Also to note, PostgreSQL has too many features for my taste. I get it's the selling point. But that usually correlates with poor performance and code complexity, too.

Of course, there's a problem of all modern fast database engines being proprietary. But by not addressing the performance problem, perhaps with an smaller engine lighter in features, open source is left biting the dust. And that's not good for the industry.

[+] mmartinson|7 years ago|reply
Thank you pg maintainers, you've made such a wonderful thing.
[+] sergiotapia|7 years ago|reply
It really is incredible how we can get something as fundamental as a database for free that is so well made and production ready. Can you imagine if there was no postgres? We'd have to use mysql or oracle or gasp mssql.
[+] ahartmetz|7 years ago|reply
I have a serious problem with Postgres. Every year at FOSDEM, some of the most technically interesting talks are about Postgres, and the room is always far too small so I can't get in.
[+] adwhit|7 years ago|reply
The AW block is tiny but has so many great talks. All the queues end up merging with each other and jutting out into the foyer. Chaos!
[+] twic|7 years ago|reply
Sounds like you need to VACUUM ANALYZE a few of the other attendees to make room ...
[+] kbumsik|7 years ago|reply
One thing the OP didn’t mention is that the JIT is not enabled by default. They found that it has performance improvements for only long and complex queries yet. [1] But it can be enabled by a simple configuration command: jit = on.

[1]: https://www.phoronix.com/scan.php?page=news_item&px=PostgreS...

[+] anarazel|7 years ago|reply
It's expected to only have benefits for longer queries. The problem is primarily that the current logic what is likely to be a long query isn't perfect, so can trigger in the wrong moments. Since integrating the feature we'd added an item in the "pre-release item list" [1], to decide whether to enable/disable - but we definitely wanted it enabled during most of the beta test period. This wasn't really a last-minute "whaaaaaaa" thing...

[1] https://wiki.postgresql.org/wiki/PostgreSQL_11_Open_Items

[+] shrumm|7 years ago|reply
I’m already loving PG10’s native partitioning support. PG11 closes the loop on a few convenience features like being able to set foreign and primary keys at the master table level. With PG10 I can’t use ON CONFLICT clauses - looking forward to upgrading and sorting that out.
[+] LunaSea|7 years ago|reply
I encountered the same limitations as you while implementing partitioning a few months ago and it's possible to use ON CONFLICT if the unique index is set on the partitioned table.

So after initialising a new partition, I also create a unique index attached to that partition directly instead of the parent table.

[+] Nelkins|7 years ago|reply
I'm excited for hash partitioning. Being able to partition on a uuid is going to be very useful.
[+] dkubb|7 years ago|reply
I love Postgres, but the only thing I find myself wishing for was better Unicode support in the regex engine. I like to add strong database constraints, and sometimes lean on the regexp engine but I find it's missing a lot of features available in other regexp engines. PCRE compatibility would be ideal, but even just support for the Unicode \p classes would be a big step up.
[+] ggm|7 years ago|reply
I love PG. heaps better than the alternatives, for many reasons. My main one, is native IPv6 object support.

I found the migration from 9.x to 10.x deeply painful, I think the one-time cost of the dump-restore cycle hurt me far more than I expected. I very much hope the transition to 11 can be done more expeditiously.

[+] chillydawg|7 years ago|reply
For future reference, you can use logical replication to do this online between versions with a minimal window at the end for a final sync when apps are off and not changing data. By that I mean have your 9.6 in prod running as normal, set up your 10/11 newprod and then kick off logical replication for ALL TABLES from prod->newprod. That'll chug along and as long as you have appropriate resources and replication configured correctly, it'll replicate your data over and maintain it while prod is still being used. Then you turn your apps off, let it finish the sync, switch the apps over to the new db and you're good. Obviously there's some missing detail like users, extensions, replication etc, but that's always very specific to an install.
[+] RedCrowbar|7 years ago|reply
Have you tried pg_upgrade?
[+] deytempo|7 years ago|reply
What are some reasons I might consider Postgres over MySQL when choosing a DB platform?
[+] petre|7 years ago|reply
JSON support, ability to query it, JSONB support, real spatial extensions, timescale extensions, consistent behaviour, online backups. We now have to migrate from MySQL to Postgres because of these features. Instead of MySQL 8 we will be probably usng Pg 11. Now we are using MariaDB.
[+] jpalomaki|7 years ago|reply
Postgres has much better SQL support and has features which will make you smile if you end writing complex queries for some purposes (like reporting).
[+] gaius|7 years ago|reply
With Postgres you don't need MongoDB, InfluxDB, or any other trendy thing, Postgres does it all, and better than all the wannabes.
[+] sv12l|7 years ago|reply
If data is central to your business, in all likelihood it will be, and you care.
[+] brightball|7 years ago|reply
Great looking release. I’m really excited to see if the cstore extension can make good use of the parallelism improvements.
[+] macdice|7 years ago|reply
It looks like someone would need to do the things described in here: https://www.postgresql.org/message-id/flat/CA%2Bz6ocRFEnThhX...

There is an easy level "parallel safe" that would allow scans of different cstore partitions in a parallel query, and a harder-to-code "parallel aware" level that would allow parallel scans on one individual cstore_fdw relation. AFAIK no FDW has attempted parallel scans yet, but cstore looks like it may be an ideal case to be first?