l*b
2 楼
Hi, friends,
I will make some table replications between two DBs with same structure. The
main problem so far is how to prevent the PK conflict when replicating as
the current PKs are auto increased by sequence. My first thinking is the
have composite PK keys: instance id + auto increased, e.g. 01 and 1234 as a
PK pair, 01 is instance id and 1234 is current increased PK. I heard there
are some drawback in composite PK key, e.g. in ORM, etc. However, I am not
using ORM so far. Is my solution ok?
I will make some table replications between two DBs with same structure. The
main problem so far is how to prevent the PK conflict when replicating as
the current PKs are auto increased by sequence. My first thinking is the
have composite PK keys: instance id + auto increased, e.g. 01 and 1234 as a
PK pair, 01 is instance id and 1234 is current increased PK. I heard there
are some drawback in composite PK key, e.g. in ORM, etc. However, I am not
using ORM so far. Is my solution ok?
i*a
4 楼
Ms sql server? Replication takes care of pk automatically. In fact it
requires a pk for repl to work
requires a pk for repl to work
v*r
6 楼
I guess your concerns is that your target db is inserted not only by the
replication process, so the the target db sequence might clash with the
source db sequence.
The workaround is simple, modify your target db sequence to start with a
much higher value to ensure the source/target db sequences are using
different range.
Your thought will work but the problem is you are making your application un
-scalable by "instance id + auto increased".
replication process, so the the target db sequence might clash with the
source db sequence.
The workaround is simple, modify your target db sequence to start with a
much higher value to ensure the source/target db sequences are using
different range.
Your thought will work but the problem is you are making your application un
-scalable by "instance id + auto increased".
l*b
8 楼
Thank you, vbitter.
Could you advise me some examples of making your application unscalable by "
instance id + auto increased"?
un
【在 v*****r 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: I guess your concerns is that your target db is inserted not only by the
: replication process, so the the target db sequence might clash with the
: source db sequence.
: The workaround is simple, modify your target db sequence to start with a
: much higher value to ensure the source/target db sequences are using
: different range.
: Your thought will work but the problem is you are making your application un
: -scalable by "instance id + auto increased".
Could you advise me some examples of making your application unscalable by "
instance id + auto increased"?
un
【在 v*****r 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: I guess your concerns is that your target db is inserted not only by the
: replication process, so the the target db sequence might clash with the
: source db sequence.
: The workaround is simple, modify your target db sequence to start with a
: much higher value to ensure the source/target db sequences are using
: different range.
: Your thought will work but the problem is you are making your application un
: -scalable by "instance id + auto increased".
v*r
10 楼
Luckybb,
On second thought, I was wrong. Sequence helps you Apps scale better mainly
because it can be cached in memory. So as long as your sequence is defined
with CACHE option and you are inserting right after append "instance_id"
with "sequence number" on preparing PK value, there will be a little bit
more overhead in preparing PK value, but it won't affect your application's
scalability.
"
【在 l*****b 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: Thank you, vbitter.
: Could you advise me some examples of making your application unscalable by "
: instance id + auto increased"?
:
: un
On second thought, I was wrong. Sequence helps you Apps scale better mainly
because it can be cached in memory. So as long as your sequence is defined
with CACHE option and you are inserting right after append "instance_id"
with "sequence number" on preparing PK value, there will be a little bit
more overhead in preparing PK value, but it won't affect your application's
scalability.
"
【在 l*****b 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: Thank you, vbitter.
: Could you advise me some examples of making your application unscalable by "
: instance id + auto increased"?
:
: un
l*b
12 楼
thanks for quick and deep answer. Besides this generated PK, I am also
thinking one more solution to have composite primary key. I will have two
columns - instance_id and big int sequence number, then define them as a
composite primary key.
mainly
s
【在 v*****r 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: Luckybb,
: On second thought, I was wrong. Sequence helps you Apps scale better mainly
: because it can be cached in memory. So as long as your sequence is defined
: with CACHE option and you are inserting right after append "instance_id"
: with "sequence number" on preparing PK value, there will be a little bit
: more overhead in preparing PK value, but it won't affect your application's
: scalability.
:
: "
thinking one more solution to have composite primary key. I will have two
columns - instance_id and big int sequence number, then define them as a
composite primary key.
mainly
s
【在 v*****r 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: Luckybb,
: On second thought, I was wrong. Sequence helps you Apps scale better mainly
: because it can be cached in memory. So as long as your sequence is defined
: with CACHE option and you are inserting right after append "instance_id"
: with "sequence number" on preparing PK value, there will be a little bit
: more overhead in preparing PK value, but it won't affect your application's
: scalability.
:
: "
v*r
14 楼
Not a good idea. Having a separate instance_id column, you are adding
something that is totally irrelevant and redundant to your table entity.
something that is totally irrelevant and redundant to your table entity.
相关阅读
Free Oracle Database Software CDs Error Code 01034?another question--怎么delete a row from a tableAccess用户级安全性问题求助!Where can I download OCP CD?[转载] Certification 计算机证书请问sambar: SQL Server数据同步复制的问题如何实现数据库的exclusive访问&更新?Help! who have ever designed the LOGOUT function in a webpage?关于Powerbuilder的DB的问题关于数据库的选择--急问simple access questionい瓣ㄈ瑆程淮计沮畐盡產question for webdb guru哪里有oracle administration 英文版的书下载sortImport a text file into Oracle...any db2 expert?what is service to startup dba studio?merge 同步复制