PostgreSQL 19 sped up foreign-key checks. The catch, documented in the fast-path commit, is that the new path is skipped when the referenced table is partitioned. I wanted a way to get that speed back on a star-schema fact load, and to know what it costs to keep it.
I ran this on PostgreSQL 18.7 and 19.0, built from the official tarballs, on a single 8 vCPU, 15 GiB KVM box. The fact file is a 5 million row CSV with valid keys into date, store, product, and customer dimensions. The customer dim has 2 million keys. Unless I say otherwise, times are medians of 3, and the FK under test is the customer key only.
The gap on 19.0
A COPY of those 5 million rows, with the fact FK pointing at an 8-partition hash-partitioned customer dim, took 73.8 seconds (range 73.0-76.0). The same COPY against a plain, non-partitioned customer dim took 14.6 seconds (14.1-14.6).…