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

>
>
> On Mar 19, 2020, at 6:45 PM, pabloa98 <pablo...@gmail.com> wrote:
>
>
>
> On Thu, Mar 19, 2020 at 5:13 PM Adrian Klaver <adrian.kla...@aklaver.com>
> wrote:
>
>> On 3/19/20 3:32 PM, pabloa98 wrote:
>> >
>> >
>> > On Thu, Mar 19, 2020 at 3:17 PM Rob Sargent <robjsarg...@gmail.com
>> > <mailto:robjsarg...@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.

Reply via email to