I also confirm this problem:
Running Michael's script on 10.1 takes 314 seconds instead of 2.3 seconds on 9.6.5.
Moreover adding some timing shows that on 10.1 the iteration execution time grows linearly with each iteration. (!!)
If we remove ALTER SEQUENCE, the difference is only 2.5 times (5 seconds for 10.1 and 2 - for 9.6.5), and the linear growth effect is not observed.
Removing advisory locks saves ~ 200ms in both cases, and still 9.6.5. seems faster.
Ivan Panchenko
Postgres Professional
the Russian PostgreSQL Company
+79104339846
22.01.2018 21:55, David G. Johnston пишет: