Re: Could postgres12 support millions of sequences? (like 10 million)

From: pabloa98 <pabloa98(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Rob Sargent <robjsargent(at)gmail(dot)com>, "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Could postgres12 support millions of sequences? (like 10 million)
Date: 2020-03-23 00:35:33
Message-ID: CAEjudX7VxHjpv3i8e+evtwVSdTWJce7j6aK32a7fNxkNKE-bWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2020-03-23 00:36:25 Re: Could postgres12 support millions of sequences? (like 10 million)
Previous Message Adrian Klaver 2020-03-23 00:10:10 Re: Duplicate key violation on upsert