From: Adrian Klaver <adrian.klaver@aklaver.com>
To: pabloa98 <pabloa98@gmail.com>
Cc: Rob Sargent <robjsargent@gmail.com>
Cc: Peter J. Holzer <hjp-pgsql@hjp.at>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Could postgres12 support millions of sequences? (like 10 million)
Date: Sun, 22 Mar 2020 17:06:49 -0700
Message-ID: <28a605f9-ec38-855b-f258-48bcae367ed2@aklaver.com> (raw)
In-Reply-To: <CAEjudX7mqE-opjcMp6OOpBtB9XCZLGZD61SnrRTX5K7LR0tQJg@mail.gmail.com>
References: <2c994f4f-6627-1c4d-fac5-d3c442d197e9@aklaver.com>
<7B1364EB-7DE5-48E7-A85D-F849EAE569F7@gmail.com>
<CAEjudX5+EShvXueTJ1xdyWhViHRievhXv+k86reAPjmhEDMXzg@mail.gmail.com>
<73f5c4ac-1bd3-d517-f507-74d042ae1365@aklaver.com>
<CAEjudX7mqE-opjcMp6OOpBtB9XCZLGZD61SnrRTX5K7LR0tQJg@mail.gmail.com>
On 3/22/20 2:53 PM, pabloa98 wrote:
>
> So the question may actually be:
>
> How do we improve our locking code, so we don't have to spawn millions
> of sequences?
>
> What is the locking method you are using?
>
>
> I am not using locking with the million sequence solution. I do not want
> something that locks because the problems described below
>
> I prefer the solution generates a gap (skip a couple of numbers) and not
> using locks.
>
>
>
> > The lock part is because we solved a similar problem with a
> counter by
> > row locking the counter and increasing it in another part of the
> > database. The result is that all the queries using that table are
> queued
> > by pair (group, element) that is not that bad because we are not
> > inserting thousands of rows by second. Still is killing cluster
> > performance (but performance is still OK from the business point of
> > view). The problem using locks is that they are too sensitive to
> > developer errors and bugs. Sometimes connected clients aborts and
> the
> > connection is returned to the pool with the lock active until the
> > connection is closed or someone unlocks the row. I would prefer
> to have
> > something more resilient to developers/programming errors, if
> possible.
> >
>
> 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.
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, pabloa98@gmail.com, robjsargent@gmail.com, hjp-pgsql@hjp.at
Subject: Re: Could postgres12 support millions of sequences? (like 10 million)
In-Reply-To: <28a605f9-ec38-855b-f258-48bcae367ed2@aklaver.com>
References: <2c994f4f-6627-1c4d-fac5-d3c442d197e9@aklaver.com> <7B1364EB-7DE5-48E7-A85D-F849EAE569F7@gmail.com> <CAEjudX5+EShvXueTJ1xdyWhViHRievhXv+k86reAPjmhEDMXzg@mail.gmail.com> <73f5c4ac-1bd3-d517-f507-74d042ae1365@aklaver.com> <CAEjudX7mqE-opjcMp6OOpBtB9XCZLGZD61SnrRTX5K7LR0tQJg@mail.gmail.com> <28a605f9-ec38-855b-f258-48bcae367ed2@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox