更新transmogrifies插入/删除 [英] update transmogrifies to insert/delete

查看:67
本文介绍了更新transmogrifies插入/删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



的问题(主要是在390 / v7上下文中)是否反复思考,如果是这样的话,行更新将成为插入/删除。


i假设表格中的列数或者字节有一个阈值,或者更新的位置,引擎只需要b / b
决定,拧紧它,我只会换一个新的。


浏览了这个群组和谷歌,但找不到任何东西。


上下文:我们有一些java人喜欢参数化/

概括/ exersize他们称之为数据访问对象,并且

最终循环通过基于列的数据库结果集

元数据(因此无需编写任何特定于表的代码),

重置所有列。制作可生成的代码,但我为一个

不喜欢它。


似乎是最糟糕的性能场景?

解决方案



" robert" < GN ***** @ rcn.com>在消息中写道

news:da ************************** @ posting.google.c om ...

一直在思考问题(主要是在390 / v7上下文中)
是否,如果是这样,行更新成为插入/删除。
我假设表格的列数或者字节数有一个阈值,在发动机决定的地方进行更新,拧紧它,我只是换一个新的。

浏览了这个群组和google,但是找不到任何东西。

上下文:我们有一些喜欢参数化/
概括/夸大的java人进入他们所谓的数据访问对象,并最终循环遍历基于列元数据的数据库结果集(因此无需编写任何特定于表的代码),
重置所有列。制作可生成的代码,但是我一个人不喜欢它。

似乎是最糟糕的性能场景?




我是Java开发人员,但我从未使用过数据访问对象,所以我可能没有资格评论这个问题。

$ b但是,如果引擎,我会非常惊讶。 _EVER_只是决定,

搞砸了,我只会做一个新的。 (我假设当你说

引擎时,你的意思是DB2代码本身,而不是某些第三方附加组件对DB2来说是
。) />

坦率地说,我从来没有听过这样一句谣言,暗示DB2可能会将SQL Update语句转换为插入

和/或删除,我已经在一个或另一个容量中使用DB2

20年。


据我所知,更新始终是更新,删除总是一个

删除,并且插入总是一个插入,这些都不能从
$ b更改$ b一个接一个。


当然,我*可能*错了....


话虽如此,一个*使用DB2的application *应该能够将

更新语句转换为删除/插入。例如,如果用户通过我写的界面提交了这样的

查询:

update Employee

set salary = salary * 1.1

其中empno =''000010''


我可以想象将其转换为:

1)删除删除了员工000010的当前行

2)为员工000010创建一个新行的插入,但是在
工资中加薪10%。


当然,执行此操作的代码还需要选择以确定原始行中所有其他列的当前值


可以在插入过程中复制到新行。


但是,相关的

数据可能很容易出现重要的副问题。例如,如果示例中的Employee表具有依赖的

表,例如Employee_Health_Claims,则在Employee

表中执行删除操作可能会导致与Employee_Health_Claims相关的所有行

如果DELETE CASCADE规则生效,则删除员工。 (如果

DELETE CASCADE规则对此外键生效,那么依赖于Employee_Health_Claims的
表中的行也可能会被删除。)


同样,如果Employee和Employee_Health_Claims之间存在

a DELETE RESTRICT规则,则Employee表中的删除将失败。如果你的b $ b选择将更新转换为删除/插入组合,那么
必须非常谨慎地考虑参照完整性问题。


毕竟,你不希望在一个表中更新导致各种

数据被删除只是因为你认为你可能会获得一点点优势

将一个更新变为删除后跟一个插入。


因为我不确定我是否真的理解你的问题的意图,我

不知道这是否能解决问题。如果没有,也许你可以澄清一下你是什么后的
。然后我 - 或者这个新闻组中的其他人 - 可以再试一次。


犀牛


我会不同意这里有一点点。

DB2 UDB for LUW:

多维集群表格。

如果更新其中一个列作为维度选择,唯一的方法

DB2可以处理这个来维护集群就是删除它所在的块中存在的行,并在其中插入带有新维度的行br />
适当的块。

除此之外我完全赞同Rhino。


Rhino写道:

" robert" < GN ***** @ rcn.com>在消息中写道
新闻:da ************************** @ posting.google.c om ...

一直在思考问题(主要是在390 / v7上下文中)
是否,如果是这样,行更新成为插入/删除。
我假设表格的列数或者字节数有一个阈值,在发动机决定的地方进行更新,拧紧它,我只是换一个新的。

浏览了这个群组和google,但是找不到任何东西。

上下文:我们有一些喜欢参数化/
概括/夸大的java人进入他们所谓的数据访问对象,并最终循环遍历基于列元数据的数据库结果集(因此无需编写任何特定于表的代码),
重置所有列。制作可生成的代码,但是我一个人不喜欢它。

似乎是最糟糕的性能场景?



我是Java开发人员,但我从未使用过数据访问对象,所以我可能没有资格评论这个问题。

但是,如果我会非常惊讶发动机 _EVER_只是决定,
搞砸,我只会做一个新的。 (我假设当你说
引擎时,你指的是DB2代码本身,而不是DB2的某些第三方附加组件。)

坦率地说,我从来没有听过这样一句谣言,说明DB2可以将SQL Update语句转换为插入
和/或删除而且我已经以一种或另一种方式与DB2合作20年。

据我所知,更新始终是更新,删除始终是删除,以及插入始终是一个插入,这些都不会从一个插入到另一个插入。

当然,我*可能*错了....

话虽如此,使用DB2的* application *应该能够将
更新语句转换为删除/插入。例如,如果用户通过我写的界面提交了这样的
查询:
更新员工
设置薪水=工资* 1.1
其中empno =''000010''

我可以想象将其转换为:
1)删除员工000010当前行的删除
2)插入为员工000010创建新行但是工资增加10%。

当然,执行此操作的代码还需要选择以确定原始行中所有其他列的当前值这样它们就可以在插入过程中复制到新行。

但是,相关的数据很容易出现重要的问题。例如,如果示例中的Employee表具有依赖的表,例如Employee_Health_Claims,则在Employee
表中执行删除操作可能会导致与该
Employee相关的所有Employee_Health_Claims行如果DELETE CASCADE规则生效,则删除。 (如果
DELETE CASCADE规则对此外键生效,那么依赖于Employee_Health_Claims的表中的行也可能会被删除。)

同样,删除如果Employee和Employee_Health_Claims之间存在DELETE RESTRICT规则,则Employee表将失败。如果您选择将更新转换为删除/插入组合,则必须非常仔细地考虑参照完整性问题。

毕竟,您不会想要一个在一个表中更新以删除各种数据只是因为您认为可能会获得轻微的优势
将一个更新转换为删除后跟一个插入。
既然我不确定我是否真的理解你问题的意图,我不知道这是否能解决问题。如果没有,也许你可以澄清你的内容。然后我 - 或者这个新闻组的其他人 - 可以再试一次。

Rhino




-

Pierre Saint-Jacques - 回复:sesconsjunk at attglobaljunk dot com

重建地址:删除两个垃圾并用

代替它们的符号。

IBM DB2 Cerified解决方案专家 - 管理

SES顾问公司


我只想稍微区别一点点这里。

DB2 UDB for LUW:

多维集群表格。

如果更新其中一个列作为维度,唯一的方法

DB2可以处理这个来维护集群就是删除它所在的块中存在的行,并在其

正确的阻止。

除此之外我完全同意Rhino。


Rhino写道:

罗伯特 < GN ***** @ rcn.com>在消息中写道
新闻:da ************************** @ posting.google.c om ...

一直在思考问题(主要是在390 / v7上下文中)
是否,如果是这样,行更新成为插入/删除。
我假设表格的列数或者字节数有一个阈值,在发动机决定的地方进行更新,拧紧它,我只是换一个新的。

浏览了这个群组和google,但是找不到任何东西。

上下文:我们有一些喜欢参数化/
概括/夸大的java人进入他们所谓的数据访问对象,并最终循环遍历基于列元数据的数据库结果集(因此无需编写任何特定于表的代码),
重置所有列。制作可生成的代码,但是我一个人不喜欢它。

似乎是最糟糕的性能场景?



我是Java开发人员,但我从未使用过数据访问对象,所以我可能没有资格评论这个问题。

但是,如果我会非常惊讶发动机 _EVER_只是决定,
搞砸,我只会做一个新的。 (我假设当你说
引擎时,你指的是DB2代码本身,而不是DB2的某些第三方附加组件。)

坦率地说,我从来没有听过这样一句谣言,说明DB2可以将SQL Update语句转换为插入
和/或删除而且我已经以一种或另一种方式与DB2合作20年。

据我所知,更新始终是更新,删除始终是删除,以及插入始终是一个插入,这些都不会从一个插入到另一个插入。

当然,我*可能*错了....

话虽如此,使用DB2的* application *应该能够将
更新语句转换为删除/插入。例如,如果用户通过我写的界面提交了这样的
查询:
更新员工
设置薪水=工资* 1.1
其中empno =''000010''

我可以想象将其转换为:
1)删除员工000010当前行的删除
2)插入为员工000010创建新行但是工资增加10%。

当然,执行此操作的代码还需要选择以确定原始行中所有其他列的当前值这样它们就可以在插入过程中复制到新行。

但是,相关的数据很容易出现重要的问题。例如,如果示例中的Employee表具有依赖的表,例如Employee_Health_Claims,则在Employee
表中执行删除操作可能会导致与该
Employee相关的所有Employee_Health_Claims行如果DELETE CASCADE规则生效,则删除。 (如果
DELETE CASCADE规则对此外键生效,那么依赖于Employee_Health_Claims的表中的行也可能会被删除。)

同样,删除如果Employee和Employee_Health_Claims之间存在DELETE RESTRICT规则,则Employee表将失败。如果您选择将更新转换为删除/插入组合,则必须非常仔细地考虑参照完整性问题。

毕竟,您不会想要一个在一个表中更新以删除各种数据只是因为您认为可能会获得轻微的优势
将一个更新转换为删除后跟一个插入。
既然我不确定我是否真的理解你问题的意图,我不知道这是否能解决问题。如果没有,也许你可以澄清你的内容。然后我 - 或者这个新闻组的其他人 - 可以再试一次。

Rhino




-

Pierre Saint-Jacques - 回复:sesconsjunk at attglobaljunk dot com

重建地址:删除两个垃圾并用

代替它们的符号。

IBM DB2 Cerified Solutions Expert - 管理

SES顾问公司


been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.

i assume that there is a threshold on the number of columns of
the table, or perhaps bytes, being updated where the engine just
decides, screw it, i''ll just make a new one.

surfed this group and google, but couldn''t find anything.

the context: we have some java folk who like to parametize/
generalize/exersize into what they call Data Access Objects, and
end up looping through a database result set based on column
metadata (thus not having to write any table specific code),
resetting all columns. makes for generatable code, but i for one
don''t like it.

seems to be the worst possible performance scenario??

解决方案


"robert" <gn*****@rcn.com> wrote in message
news:da**************************@posting.google.c om...

been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.

i assume that there is a threshold on the number of columns of
the table, or perhaps bytes, being updated where the engine just
decides, screw it, i''ll just make a new one.

surfed this group and google, but couldn''t find anything.

the context: we have some java folk who like to parametize/
generalize/exersize into what they call Data Access Objects, and
end up looping through a database result set based on column
metadata (thus not having to write any table specific code),
resetting all columns. makes for generatable code, but i for one
don''t like it.

seems to be the worst possible performance scenario??



I''m a Java developer but I''ve never used Data Access Objects so I may not be
qualified to comment on this question.

However, I would be quite astonished if "the engine" _EVER_ "just decides,
screw it, I''ll just make a new one". (I assume that when you say "the
engine" you mean the DB2 code itself, as opposed to some third party add-on
to DB2.)

Frankly, I''ve never heard so much as a whisper of a hint of a rumour of a
suggestion that DB2 could transform an SQL Update statement to an Insert
and/or a Delete and I''ve been working with DB2 in one capacity or another
for 20 years.

As far as I know, an Update is always an Update, a Delete is always a
Delete, and an Insert is always an Insert and none of these can change from
one to the other.

Of course, I *could* be wrong....

Having said that, an *application* which uses DB2 should be able to turn an
update statement into a delete/insert. For instance, if a user submitted a
query like this through an interface that I wrote:
update Employee
set salary = salary * 1.1
where empno = ''000010''

I could imagine converting that to:
1) a delete that removed the current row for employee 000010
2) an insert to create a new row for employee 000010 but with a 10% raise in
salary.

Of course, the code to do this would also need a select to determine the
current values of all of the other columns in the original row so that they
could be copied to the new row during the insert.

However, there could easily be important side-issues with respect to related
data. For instance, if the Employee table in the example had dependent
tables, such as Employee_Health_Claims, doing the delete in the Employee
table could cause all rows of Employee_Health_Claims that relate to that
Employee to be deleted if a DELETE CASCADE rule was in effect. (And rows in
tables dependent on Employee_Health_Claims might also be deleted if the
DELETE CASCADE rule was in effect on this foreign keys.)

By the same token, the delete in the Employee table would fail if there was
a DELETE RESTRICT rule between Employee and Employee_Health_Claims. You
would have to consider Referential Integrity issues very carefully if you
chose to convert an Update into a Delete/Insert combination.

After all, you wouldn''t want an update in one table to cause all sorts of
data to be deleted just because you thought you might get a slight advantage
by turning one Update into a Delete followed by an Insert.

Since I''m not sure if I really understood the intent of your question, I
don''t know if this answers it. If not, perhaps you can clarify what you are
after. Then I - or others on this newsgroup - could try again.

Rhino


I''d beg to differ just a little bit here.
IN DB2 UDB for LUW:
Multi Dimension Clusterd tables.
If one updates one of the columns chosen as a dimension, the only way
DB2 can deal with this to maintain clustering is to delete the row where
it lived in its block and insert the row with the new dimension in its
proper block.
Apart from this I''d totally agree with Rhino.

Rhino wrote:

"robert" <gn*****@rcn.com> wrote in message
news:da**************************@posting.google.c om...

been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.

i assume that there is a threshold on the number of columns of
the table, or perhaps bytes, being updated where the engine just
decides, screw it, i''ll just make a new one.

surfed this group and google, but couldn''t find anything.

the context: we have some java folk who like to parametize/
generalize/exersize into what they call Data Access Objects, and
end up looping through a database result set based on column
metadata (thus not having to write any table specific code),
resetting all columns. makes for generatable code, but i for one
don''t like it.

seems to be the worst possible performance scenario??


I''m a Java developer but I''ve never used Data Access Objects so I may not be
qualified to comment on this question.

However, I would be quite astonished if "the engine" _EVER_ "just decides,
screw it, I''ll just make a new one". (I assume that when you say "the
engine" you mean the DB2 code itself, as opposed to some third party add-on
to DB2.)

Frankly, I''ve never heard so much as a whisper of a hint of a rumour of a
suggestion that DB2 could transform an SQL Update statement to an Insert
and/or a Delete and I''ve been working with DB2 in one capacity or another
for 20 years.

As far as I know, an Update is always an Update, a Delete is always a
Delete, and an Insert is always an Insert and none of these can change from
one to the other.

Of course, I *could* be wrong....

Having said that, an *application* which uses DB2 should be able to turn an
update statement into a delete/insert. For instance, if a user submitted a
query like this through an interface that I wrote:
update Employee
set salary = salary * 1.1
where empno = ''000010''

I could imagine converting that to:
1) a delete that removed the current row for employee 000010
2) an insert to create a new row for employee 000010 but with a 10% raise in
salary.

Of course, the code to do this would also need a select to determine the
current values of all of the other columns in the original row so that they
could be copied to the new row during the insert.

However, there could easily be important side-issues with respect to related
data. For instance, if the Employee table in the example had dependent
tables, such as Employee_Health_Claims, doing the delete in the Employee
table could cause all rows of Employee_Health_Claims that relate to that
Employee to be deleted if a DELETE CASCADE rule was in effect. (And rows in
tables dependent on Employee_Health_Claims might also be deleted if the
DELETE CASCADE rule was in effect on this foreign keys.)

By the same token, the delete in the Employee table would fail if there was
a DELETE RESTRICT rule between Employee and Employee_Health_Claims. You
would have to consider Referential Integrity issues very carefully if you
chose to convert an Update into a Delete/Insert combination.

After all, you wouldn''t want an update in one table to cause all sorts of
data to be deleted just because you thought you might get a slight advantage
by turning one Update into a Delete followed by an Insert.

Since I''m not sure if I really understood the intent of your question, I
don''t know if this answers it. If not, perhaps you can clarify what you are
after. Then I - or others on this newsgroup - could try again.

Rhino



--
Pierre Saint-Jacques - Reply to: sesconsjunk at attglobaljunk dot com
Reconstruct address: Remove the two junk and replace at and dot by
their symbols.
IBM DB2 Cerified Solutions Expert - Administration
SES Consultants Inc.


I''d beg to differ just a little bit here.
IN DB2 UDB for LUW:
Multi Dimension Clusterd tables.
If one updates one of the columns chosen as a dimension, the only way
DB2 can deal with this to maintain clustering is to delete the row where
it lived in its block and insert the row with the new dimension in its
proper block.
Apart from this I''d totally agree with Rhino.

Rhino wrote:

"robert" <gn*****@rcn.com> wrote in message
news:da**************************@posting.google.c om...

been ruminating on the question (mostly in a 390/v7 context) of
whether, and if so when, a row update becomes an insert/delete.

i assume that there is a threshold on the number of columns of
the table, or perhaps bytes, being updated where the engine just
decides, screw it, i''ll just make a new one.

surfed this group and google, but couldn''t find anything.

the context: we have some java folk who like to parametize/
generalize/exersize into what they call Data Access Objects, and
end up looping through a database result set based on column
metadata (thus not having to write any table specific code),
resetting all columns. makes for generatable code, but i for one
don''t like it.

seems to be the worst possible performance scenario??


I''m a Java developer but I''ve never used Data Access Objects so I may not be
qualified to comment on this question.

However, I would be quite astonished if "the engine" _EVER_ "just decides,
screw it, I''ll just make a new one". (I assume that when you say "the
engine" you mean the DB2 code itself, as opposed to some third party add-on
to DB2.)

Frankly, I''ve never heard so much as a whisper of a hint of a rumour of a
suggestion that DB2 could transform an SQL Update statement to an Insert
and/or a Delete and I''ve been working with DB2 in one capacity or another
for 20 years.

As far as I know, an Update is always an Update, a Delete is always a
Delete, and an Insert is always an Insert and none of these can change from
one to the other.

Of course, I *could* be wrong....

Having said that, an *application* which uses DB2 should be able to turn an
update statement into a delete/insert. For instance, if a user submitted a
query like this through an interface that I wrote:
update Employee
set salary = salary * 1.1
where empno = ''000010''

I could imagine converting that to:
1) a delete that removed the current row for employee 000010
2) an insert to create a new row for employee 000010 but with a 10% raise in
salary.

Of course, the code to do this would also need a select to determine the
current values of all of the other columns in the original row so that they
could be copied to the new row during the insert.

However, there could easily be important side-issues with respect to related
data. For instance, if the Employee table in the example had dependent
tables, such as Employee_Health_Claims, doing the delete in the Employee
table could cause all rows of Employee_Health_Claims that relate to that
Employee to be deleted if a DELETE CASCADE rule was in effect. (And rows in
tables dependent on Employee_Health_Claims might also be deleted if the
DELETE CASCADE rule was in effect on this foreign keys.)

By the same token, the delete in the Employee table would fail if there was
a DELETE RESTRICT rule between Employee and Employee_Health_Claims. You
would have to consider Referential Integrity issues very carefully if you
chose to convert an Update into a Delete/Insert combination.

After all, you wouldn''t want an update in one table to cause all sorts of
data to be deleted just because you thought you might get a slight advantage
by turning one Update into a Delete followed by an Insert.

Since I''m not sure if I really understood the intent of your question, I
don''t know if this answers it. If not, perhaps you can clarify what you are
after. Then I - or others on this newsgroup - could try again.

Rhino



--
Pierre Saint-Jacques - Reply to: sesconsjunk at attglobaljunk dot com
Reconstruct address: Remove the two junk and replace at and dot by
their symbols.
IBM DB2 Cerified Solutions Expert - Administration
SES Consultants Inc.


这篇关于更新transmogrifies插入/删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆