Re: Could postgres12 support millions of sequences? (like 10 million) - Mailing list pgsql-general

From pabloa98
Subject Re: Could postgres12 support millions of sequences? (like 10 million)
Date
Msg-id CAEjudX7VxHjpv3i8e+evtwVSdTWJce7j6aK32a7fNxkNKE-bWA@mail.gmail.com
Whole thread Raw
In response to Re: Could postgres12 support millions of sequences? (like 10 million)  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general

> Now I read this paragraph, I realize I was not clear enough.
> I am saying we do not want to use locks because of all the problems
> described.

And what I was asking is what locking where you doing?

And it might be better to ask the list how to solve those problems, then
to create a whole new set of problems by using millions of sequences.

What we are doing in the **OTHER section** with row locks is basically:

BEGIN;
...
x = SELECT last_value + 1 FROM counter WHERE group = ... AND element = .... FOR UPDATE;
...

if everything is fine, then:
    UPDATE counter SET last_value = x WHERE group = ... AND element = .... FOR UPDATE;
    COMMIT;
else:
    ROLLBACK;



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Duplicate key violation on upsert
Next
From: Christopher Browne
Date:
Subject: Re: Could postgres12 support millions of sequences? (like 10 million)