SERIAL behavior CDR_SERIAL
Posted in 2012
Topics: General Discussion
OS : AIX
Version : Informix 11.7 xC5
Environment : Flexible Grib
Rule of replication : Apply all for all server.
My client is intended to move their existing DB from XXXX to Informix
11.7(Flexible Grib) environment.
There uses lots of auto numbering as their primary key (similar to serial data
type in informix) and there are running on distributed environment.
There are about 1000 tables in their environment and about 680 of them is
using auto numbering.
As part of the flexible grib setting, setting the cdr_serial is a must.
Assuming I had configured the following for the cdr_serial
Server A : 5,0
Server B : 5,1
Server C : 5,2
Server D : 5,3
Server E : 5,4
Questions
1. When migrating to Informix database(existing data), how does the serial
number will behave? Informix will take the max number of the serial column(of
that particular table) and apply the policy set at cdr_serial?
To simplify the discussion, assumed that we have following setting
Table_1, max serial number is 123457
Table_2, max serial number is 343
Table_3, max serial number is 6987970
Table_4, max serial number is 79696
a) If I were to insert a record in Table_1 (on Server A) what will be my next
serial number?
b) On server B, when I insert a new record at Table_1, what will be my next
serial number?
c) On server A, when I insert a new record at Table_2, what will be my next
serial number?
d) On server C, when I insert a new record at Table_2, what will be my next
serial number?
2. Assume I have the following table created in Server A
create table TAB_K ( col1 bigserial(100000000), col2 char(50) )
and on Server B, I have the similar table created but with different starting
number i.e.
create table TAB_K ( col1 bigserial(200000000), col2 char(50) )
and on Server C,
create table TAB_K ( col1 bigserial(300000000), col2 char(50) )
and on Server D,
create table TAB_K ( col1 bigserial(400000000), col2 char(50) )
on on Server E,
create table TAB_K ( col1 bigserial(500000000), col2 char(50) )
a) When I insert the first record at TAB_B on server A, what is my first value
of serial number and what will be my next serial number if I insert the 2nd
record at the same table and same server?
b) The same scenario happen at server B, what is my first serial number also
the 2nd value of serial number ?
Thanks
When you create the tables pre-set the serial/serial8/bigserial columns to
a value higher than the largest existing value and the CDR_SERIAL will take
over from there.
ex:
create table .... (
colname SERIAL(23456780),
....
);
Art
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on my employer, Advanced DataTools, the IIUG, nor any
other organization with which I am associated either explicitly,
implicitly, or by inference. Neither do those opinions reflect those of
other individuals affiliated with any entity with which I am affiliated nor
those of the entities themselves.
On Fri, Nov 9, 2012 at 2:27 AM, LEY PATRICK <patrickley@gmail.com> wrote:
> OS : AIX
> Version : Informix 11.7 xC5
> Environment : Flexible Grib
> Rule of replication : Apply all for all server.
>
> My client is intended to move their existing DB from XXXX to Informix
> 11.7(Flexible Grib) environment.
>
> There uses lots of auto numbering as their primary key (similar to serial
> data
> type in informix) and there are running on distributed environment.
>
> There are about 1000 tables in their environment and about 680 of them is
> using auto numbering.
>
> As part of the flexible grib setting, setting the cdr_serial is a must.
>
> Assuming I had configured the following for the cdr_serial
> Server A : 5,0
> Server B : 5,1
> Server C : 5,2
> Server D : 5,3
> Server E : 5,4
>
> Questions
> 1. When migrating to Informix database(existing data), how does the serial
> number will behave? Informix will take the max number of the serial
> column(of
> that particular table) and apply the policy set at cdr_serial?
>
> To simplify the discussion, assumed that we have following setting
> Table_1, max serial number is 123457
> Table_2, max serial number is 343
> Table_3, max serial number is 6987970
> Table_4, max serial number is 79696
>
> a) If I were to insert a record in Table_1 (on Server A) what will be my
> next
> serial number?
>
> b) On server B, when I insert a new record at Table_1, what will be my next
> serial number?
>
> c) On server A, when I insert a new record at Table_2, what will be my next
> serial number?
>
> d) On server C, when I insert a new record at Table_2, what will be my next
> serial number?
>
> 2. Assume I have the following table created in Server A
> create table TAB_K ( col1 bigserial(100000000), col2 char(50) )>
> and on Server B, I have the similar table created but with different
> starting
> number i.e.
> create table TAB_K ( col1 bigserial(200000000), col2 char(50) )>
> and on Server C,
> create table TAB_K ( col1 bigserial(300000000), col2 char(50) )>
> and on Server D,
> create table TAB_K ( col1 bigserial(400000000), col2 char(50) )>
> on on Server E,
> create table TAB_K ( col1 bigserial(500000000), col2 char(50) )>
> a) When I insert the first record at TAB_B on server A, what is my first
> value
> of serial number and what will be my next serial number if I insert the 2nd
> record at the same table and same server?
>
> b) The same scenario happen at server B, what is my first serial number
> also
> the 2nd value of serial number ?
>
> Thanks
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--e89a8ff1c94c6935c404ce0c7f4d