I'm using PG10.1 on CentOS Linux release 7.4.1708 (Core) after upgrading it from PG9.6.6. My application heavily uses sequences and requires different increments of sequence numbers, e.g. a range of 100, 1000 or 5000 numbers, so it is not possible to set a fixed increment on a sequence that can be used by my application.
With PG10.1 the performance has dropped seriously so that my application becomes unusable. After investigating different aspects, I was able to isolate the issue to be related to the sequences in Postgres 10.1.
Below shows a simple test script showing the problem:
[...]
On my computer I tried this code on PG9.6.6 and it executed in roughly 3 seconds.
When running it on PG10.1 it takes over 7 minutes.
Further investigation showed that the problem is related to ALTER SEQUENCE...
I can't believe that PG10.1 was changed that dramatically without providing a workaround or a way to switch to the old PG9.6 performance, at least I can't find anything in the documentation.
Is this a bug?
Without testing/confirming I'd be inclined to agree that this is a regression for an unusual usage of sequences. Work was done to make typical use cases of sequences more feature-full and it is quite possible the added effort involved hurts your specific scenario. I'd expect a hacker to eventually pick this up, confirm the observation, and provide feedback. This seems like sufficient amount of detail to get the ball rolling.