Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jF6ye-0001Vj-NL for pgsql-general@arkaria.postgresql.org; Fri, 20 Mar 2020 02:01:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jF6yc-0006Bw-QE for pgsql-general@arkaria.postgresql.org; Fri, 20 Mar 2020 02:01:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jF6yc-0006Bp-E7 for pgsql-general@lists.postgresql.org; Fri, 20 Mar 2020 02:01:34 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jF6yU-0005zi-3h for pgsql-general@lists.postgresql.org; Fri, 20 Mar 2020 02:01:34 +0000 Received: by mail-il1-x131.google.com with SMTP id k29so4250616ilg.0 for ; Thu, 19 Mar 2020 19:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ps9wdUL/NbHiLQVax0c4nhPkmsIL1uKV+G7JwGy39Yc=; b=YM35vVcZPP+HBit+SRlcA3AdxM3onRUqjiHEUh74JsoZHrEOhQZoAAHKOtbpQ1q+ug zyj0TYAFmqPnxkswojNdBz7uVqJkoBYb1BEV7ZjQA4VATqdNaEKZNv/yqAutljcbnj5r cqAD9g+PmW57zrU8XBey9xSci+TrIRRcPn6E6YfnGOvBfbwK7/3bU9Ro3hrxaZtVbW2+ 0x4CAAjMsrZany919BJTy8nJu5DHWxmcF8/vSC6DE1HL3MM7Gm+TIMaMES378QalGCSv qD2/Jinh3R6XTfhxJoXT2uvJYyLXX3v7awKDkMOCKzTRsho53zDTSEObAAtQFNFry9vM zjxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ps9wdUL/NbHiLQVax0c4nhPkmsIL1uKV+G7JwGy39Yc=; b=Z80Cuu+XWRNANMjZ9COLSgxFJSpslssDfGlv2YSXdGq7dbZPHzJxacYM6iX4W/4SeK F3t2TDGOzL1y8WseiYzApRH1YZfkcMAYm51KoqlKm+T1dFGEs8RCvBEkAe95nyiyoFbb 26v2jYylApE5Gk9svZGhToor0o/Q1+5BZTQm+ihJ5UB3uBU75P95k49iF9q7ZeDNEi5Y H7bIApN6jTdkMZuNWpT/z0qkftHjVjTFT6W7ZNu4hk9ajC6XFwhSfC71utF8Ecbw23Gz 1++3/YYsbrPWSMDejb8cTDXzpAgh28pJdxFdDG9Xdrim8+vmIimJPtlNcyouVIrpmnZy Ukgg== X-Gm-Message-State: ANhLgQ0iL3bpzDu4+IZQH1dIZolFVtvDY0vuMMNKp7vYTnXe36UudkyR Ax7zUdrnpDawxcUALWPTIeU= X-Google-Smtp-Source: ADFU+vvNT151jepho9PKHCdLHevh+SEgwyxz769a4/y5kxy/OIBbLjniA8BVjCFR1ZPXfqP0qrfm4w== X-Received: by 2002:a92:a1c6:: with SMTP id b67mr256641ill.27.1584669684280; Thu, 19 Mar 2020 19:01:24 -0700 (PDT) Received: from [192.168.1.108] (c-73-63-59-118.hsd1.ut.comcast.net. [73.63.59.118]) by smtp.gmail.com with ESMTPSA id l6sm1531296ilh.27.2020.03.19.19.01.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2020 19:01:23 -0700 (PDT) From: Rob Sargent Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_1EE560E0-B805-4756-96DF-755EA4BAF84C" Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Subject: Re: Could postgres12 support millions of sequences? (like 10 million) Date: Thu, 19 Mar 2020 20:01:20 -0600 In-Reply-To: Cc: Adrian Klaver , "pgsql-generallists.postgresql.org" To: pabloa98 References: <7CF69CD4-AE4A-4C2B-9621-4462B4AE1726@gmail.com> X-Mailer: Apple Mail (2.3608.60.0.2.5) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_1EE560E0-B805-4756-96DF-755EA4BAF84C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Mar 19, 2020, at 7:35 PM, pabloa98 wrote: >=20 >=20 >=20 > On Thu, Mar 19, 2020 at 6:16 PM Rob Sargent > wrote: >=20 >=20 >> On Mar 19, 2020, at 6:45 PM, pabloa98 > wrote: >>=20 >>=20 >>=20 >> On Thu, Mar 19, 2020 at 5:13 PM Adrian Klaver = > wrote: >> On 3/19/20 3:32 PM, pabloa98 wrote: >> >=20 >> >=20 >> > On Thu, Mar 19, 2020 at 3:17 PM Rob Sargent =20 >> > >> = wrote:I have a table called "pair": >>=20 >> CREATE TABLE pair( >> group INT NOT NULL, >> element INT NOT NULL, >> CONSTRAINT PRIMARY KEY (group, element) >> ); >>=20 >> I must add entries to the table "event". This table event will have a = code that will be generated using a sequence of that is a function of = s(group,element).=20 >> CREATE TABLE event( >> group INT NOT NULL, >> element INT NOT NULL, >> code INT NOT NULL, >> CONSTRAINT PRIMARY KEY(code, element, group) >> ); >>=20 > Unless event table is searched by code more than group, you probably = want to maintain the key order from the pair table's primary key. >=20 > OK. I will do that.=20 >=20 > If gaps are ok do you still near multiple sequences? >=20 > I need to start each "code" value from 1 in each (group, element) = pair. This is because we only have 99999999 codes for each pair. We do = not want to waste numbers. If there is a gap is OK but no a gap of = millions of numbers. --Apple-Mail=_1EE560E0-B805-4756-96DF-755EA4BAF84C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Mar 19, 2020, at 7:35 PM, pabloa98 <pabloa98@gmail.com> = wrote:



On Thu, Mar 19, 2020 at = 6:16 PM Rob Sargent <robjsargent@gmail.com> wrote:


On Mar 19, 2020, at 6:45 PM, pabloa98 <pabloa98@gmail.com> wrote:



On Thu, = Mar 19, 2020 at 5:13 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 3/19/20 = 3:32 PM, pabloa98 wrote:
> 
> 
> On Thu, Mar 19, 2020 at 3:17 = PM Rob Sargent <robjsargent@gmail.com 
> <mailto:robjsargent@gmail.com>> wrote:I have a table called = "pair":

CREATE TABLE pair(
group INT NOT = NULL,
element INT NOT NULL,
CONSTRAINT PRIMARY KEY (group, element)
);

I must add entries to the table = "event". This table event will have a code that will be generated using = a sequence of that is a function of s(group,element). 
CREATE = TABLE event(
group INT NOT NULL,
element INT NOT NULL,
code INT NOT = NULL,
CONSTRAINT PRIMARY KEY(code, element, = group)
);

Unless event table is searched = by code more than group, you probably want to maintain the key order = from the pair table's primary key.

OK. I will do that. 

If gaps are ok do you still near = multiple sequences?

I need to start each = "code" value from 1 in each (group, element) pair. This is because we = only have 99999999 codes for each pair. We do not want to waste numbers. = If there is a gap is OK but no a gap of millions of = numbers.

= --Apple-Mail=_1EE560E0-B805-4756-96DF-755EA4BAF84C--