Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    M

    Michael Paquier

    paquier.xyz · Personal blog · on HN since 2017

    Michael Paquier, a PostgreSQL contributor, writes feature highlights for each Postgres release, such as replication, authentication, and partitioning.

    Visit blogHN submissions
    DatabasesOpen Source & Linux
    What HN says

    HN commenters cite his posts to confirm Postgres details, such as CTE materialization changes in version 12 and libpq read-write host selection.

    Stats for nerds
    26HN people shared it
    14linked in comments
    38story points
    Jan 2025last shared
    2017people per year2025

    Top posts on HN

    1. 1
      Postgres 12 highlight – WITH clause and materialization
      9 people · 8 points · first shared 2019 · Discussion on HN
    2. 2
      SQL/JSON Path and Postgres 12
      2 people · 7 points · first shared 2019 · Discussion on HN
    3. 3
      Postgres 12 Highlight – Reindex Concurrently
      2 people · 5 points · first shared 2019 · Discussion on HN
    4. 4
      Postgres 10 highlight – SCRAM authentication
      2 people · 3 points · first shared 2017 · Discussion on HN
    5. 5
      Postgres 10 highlight – Quorum set of synchronous standbys
      2 people · 3 points · first shared 2017 · Discussion on HN
    6. 6
      PostgreSQL 11 Highlight – More Partition Pruning
      1 person · 3 points · first shared 2018 · Discussion on HN
    7. 7
      Postgres 16 highlight – JSON predicates
      1 person · 2 points · first shared 2023 · Discussion on HN
    8. 8
      Postgres 12 highlight: DOS prevention
      1 person · 2 points · first shared 2018 · Discussion on HN
    9. 9
      Postgres 12 highlight – pg_promote
      1 person · 2 points · first shared 2019 · Discussion on HN
    10. 10
      Postgres 12 highlight – More progress reporting
      1 person · 2 points · first shared 2019 · Discussion on HN

    What HN people wrote when they linked it

    • throwaway_pdp09Apr 2020

      Sorry. When you said "really proud" and "so great", it was perhaps an emotive choice of words.

      In the end the semantics of CTEs should be much the same throughout. There may be small differences, and perhaps larger ones such as being able to update through a CTE, something like

      with x as (...)
      update x set ...

      I don't know if PG supprts this, and it wouldn't break my heart if it didn't. It would be easy to work around.

      Also IIRC PG has 'materialized' and 'recursive' keywords. No biggie.

      So the semantics are substantially the same. Difference is, how the optimiser treats it. That means you will get the same results back but the time difference may be enormous. This explains it: https://paquier.xyz/postgresql-2/postgres-12-with-materialize/

      In my previous work, the predicate pushdown (which is the posh term for the optimiser rewriting the query as the above link demonstrates) made CTEs usable. Without them, performance would have destroyed the company.

      Can we get round it? Mostly, yes, but it would have been more work for us (meaning more human hours) which the DB optimiser should have saved us from.

      The only unique thing CTEs bring to the party is recursion. Otherwise they are no more than a convenience, albeit a great one.

      HTH

      EDIT: MSSQL has a good optimiser when it works. I recently wrote a trivial CTE and had it take a minute to run, WTF? Looked at the query plan, something was very wrong there, pulled out the CTE part and put it into a temp table, ran in…

    • elvinyungApr 2017

      The state can never fit on just a single machine, unless you're perfectly confident that single machine will never fail :)

      Distributed consistency as discussed in this blog post is not really about scaling write throughput (which is the problem solved by horizontal/vertical partitioning), but rather about keeping replicas in sync with each other, seeing the same state. The usual suspects, MySQL and Postgres, don't really have any sort of replication that's totally synchronous (although they're getting there[1, 2]).

      As for scaling writes, I agree that chopping up your Postgres database is the safest choice for now, but it's generally true that this is hacky, and kind of a pain to architect your application around it. Solutions like Spanner and FaunaDB aim to free the application developer from this burden, without having to give up the large feature set of relational databases by using a NoSQL database.

      [1] https://dev.mysql.com/doc/refman/5.7/en/group-replication.html

      [2] http://paquier.xyz/postgresql-2/postgres-10-quorum-sync/

    • steve-chavezJul 2021

      You mean event triggers[1] right?

      For the problem mentioned in the blog post — protecting roles — it's not possible to use event triggers because PostgreSQL doesn't fire[2] a DDL event for `CREATE/ALTER/DROP ROLE`.

      If an event for role modification was added, then maybe the same could be accomplished with event triggers(perhaps in pure SQL). Though hooks will always be more strict, since you can enforce conditions by preloading the extension in C code, without custom SQL. Also, hooks can enforce a condition even in presence of superusers[3], something that event triggers can't because a superuser can drop them.

      [1]: https://www.postgresql.org/docs/current/sql-createeventtrigger.html

      [2]: https://www.postgresql.org/docs/current/event-trigger-matrix.html (full list of events fired)

      [3]: https://paquier.xyz/postgresql-2/hooks-in-postgres-super-superuser-restrictions/ (example hook that does this)

    • asahDec 2018

      can confirm.

      That said, one can often capture much of the performance benefit with Postgres indexes - basically, instead of trying to tightly-pack the base tables, copy the data into indexes which are tightly packed exactly as you need. Put another way, Postgres indexes are synchronously updated materialized views - and yes, the Postgres planner/optimizer will automatically answer queries from an index if it's faster and all the columns are in there.

      I esp recommend reading about function and expression indexes, as well as the (new) covering indexes.

      http://blog.scoutapp.com/articles/2016/05/31/3-postgresql-indexing-tricks-that-surprise-everyone
      https://www.endpoint.com/blog/2013/06/10/postgresql-functional-indexes
      https://paquier.xyz/postgresql-2/postgres-11-covering-indexes/

    • aidosSep 2017

      This is a bit outside my area of expertise. Not sure about the best way to do the automated promotion process, but looking through these docs there's mention of a change to libpq that allows you to specify all the potential hosts and then have it only connect to whichever one is accepting writes (target_session_attrs).

      http://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/

      Edit to add: I'm also interested to hear the approaches people use here. Today we've been setting up WAL-E to run our db backups so we're in that headspace. I'd actually like to decommission my main db server and provision another one to take its place. Getting the new one up and running from the wal-e archives is easy enough, the switch-over is a little more complex.

    • jskrablinJan 2025

      Take a look at https://github.com/hapostgres/pg_auto_failover it's quite simple to use and manage. You can use libpq support for target_session_attrs (been there since Pg 10 - https://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/ ) so you don't need active loadbalancer in front of your Pg cluster.

      You can however create your own health/status check service on top of pg_autoctl show state and use HAProxy if required.

      I don't think there's something easier to setup and manage than pg_auto_failover, Patroni always appeared very complicated to me.

    Related

    Craig Kerstienscraigkerstiens.com101 people

    Give Me Back My Monolith

    Craig Kerstiens
    Personal · last shared 2025
    Jepsenjepsen.io212 people

    Jepsen: PostgreSQL 12.3

    Jepsen
    Company · last shared 2026
    Bruce Momjianmomjian.us52 people

    PostgreSQL community impact of 2nd Quadrant purchase

    Bruce Momjian
    Personal · last shared 2025
    2ndQuadrant Blogblog.2ndquadrant.com99 people

    Data Loss at GitLab

    2ndQuadrant Blog
    Company · last shared 2025
    Aphyraphyr.com551 people

    Hexing the technical interview (2017)

    Aphyr
    Personal · last shared 2026
    Percona Blogpercona.com327 people

    UUIDs are popular, but bad for performance (2019)

    Percona Blog
    Company · last shared 2026
    CYBERTEC Blogcybertec-postgresql.com94 people

    Postgres scaling advice

    CYBERTEC Blog
    Company · last shared 2026
    depeszdepesz.com101 people

    Waiting for PostgreSQL 14 – SEARCH and CYCLE clauses

    depesz
    Personal · last shared 2026