473,753 Members | 8,077 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

update transmogrifies to insert/delete

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??
Nov 12 '05
16 3874
Serge Rielau <sr*****@ca.e ye-bee-em.com> wrote in message news:<fB******* *************@t wister01.bloor. is.net.cable.ro gers.com>...
Correct and also update to a range-clustered table.
When range partitioning become availbale, that too will have the same
behaviour.

To comment on the question what DB2 really updates in a "real" update.
DB2 actually ahndles teh fact that more elements are mentioned in the
SET clause (or before trigger) than ar eactually changed (SET c1 = c1).
By default these smarts are ON. There is a Db2 registry variable called
ASSUMEUPDATED (or something like that) which can be set to disable the
smarts (to shave some codepath in well behaved high performance
environments).
The requirement to be that smart indeed coems from teh fact that many
Apps don't bother to find out what was updated. They simply update all
the columns. The savings, btw is not in the writing of the page. It's in the logging.
And DB2 indeed logs the stripe from the first changed column to the last
changed column.
kind of figured that part <G>

this is an LUW facility? or DB2 wide? (my case study is NT, so it
doesn't, for the moment, affect 390).

robert

Cheers
Serge

Nov 12 '05 #11
I have no clue whether DB2 for z/OS has a similar implementation.

Cheers
Serge
Nov 12 '05 #12
AK
> many
Apps don't bother to find out what was updated. They simply update all
the columns.


Just wanted to add that there may be a strong reason not to bother.
Let's assume I'm performing an array update, and I've bound 40
parameters. Should I be figuring out what's actually changed and
what's not, and issuing individual dynamic updates for each row, that
would be much slower. Keeping 2^40 prepared updates is also out of
question, is it not
Nov 12 '05 #13
ak************@ yahoo.com (AK) wrote in message news:<46******* *************** ****@posting.go ogle.com>...
many
Apps don't bother to find out what was updated. They simply update all
the columns.
Just wanted to add that there may be a strong reason not to bother.
Let's assume I'm performing

an array update
real relational databases (even just 1st normal form ones) don't
have arrays. don't you read date, or even celko? <G>

, and I've bound 40 parameters. Should I be figuring out what's actually changed and
what's not, and issuing individual dynamic updates for each row, that
would be much slower. Keeping 2^40 prepared updates is also out of
question, is it not

Nov 12 '05 #14
Real relational systems don't have cleint side logic ;-)
I think SQL is SQL and procedural is procedural.
But those two conecpts must talk with each other.
Wherher the academics like it or not.
And neither Java nor .Net are SQL friendly.

Cheers
Serge
Nov 12 '05 #15
AK
gn*****@rcn.com (robert) wrote in message news:<da******* *************** ***@posting.goo gle.com>...
ak************@ yahoo.com (AK) wrote in message news:<46******* *************** ****@posting.go ogle.com>...
many
Apps don't bother to find out what was updated. They simply update all
the columns.


Just wanted to add that there may be a strong reason not to bother.
Let's assume I'm performing

an array update


real relational databases (even just 1st normal form ones) don't
have arrays. don't you read date, or even celko? <G>


you probably don't know yet about binding arrays to parameters.
if you wish to learn a little bit, start here:

http://www-106.ibm.com/developerwork...04pooloth.html
Nov 12 '05 #16
ak************@ yahoo.com (AK) wrote in message news:<46******* *************** ****@posting.go ogle.com>...
gn*****@rcn.com (robert) wrote in message news:<da******* *************** ***@posting.goo gle.com>...
ak************@ yahoo.com (AK) wrote in message news:<46******* *************** ****@posting.go ogle.com>...
> many
> Apps don't bother to find out what was updated. They simply update all
> the columns.

Just wanted to add that there may be a strong reason not to bother.
Let's assume I'm performing an array update


real relational databases (even just 1st normal form ones) don't
have arrays. don't you read date, or even celko? <G>


you probably don't know yet about binding arrays to parameters.
if you wish to learn a little bit, start here:

http://www-106.ibm.com/developerwork...04pooloth.html


it was a pun on array (there was a <G>, after all). we use a framework,
pre-Struts but much like it, and jdbc, and indexed parameters to the
servlets. an interesting article, nonetheless.

<G><G>
bumps
Nov 12 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
8613
by: Jason | last post by:
I have a table that matches up Securities and Exchanges. Individual securities can belong on multiple exchanges. One of the columns, named PrimaryExchangeFlag, indicates if a particular exchange is the primary exchange for that symbol. Each symbol can only have one primary exchange. I am trying to write a insert/update/delete trigger that enforces this rule. The rules I have thought of are as follows: Insert If new row has flag...
1
3681
by: Google Mike | last post by:
I have one table of new records (tableA) that may already exist in tableB. I want to insert these records into tableB with insert if they don't already exist, or update any existing ones with new data if they do already exist. A column (Action) in tableA already tells me whether this is an INSERT, UPDATE, or DELETE. I'm able to derive that I can do an insert with select * into tableB from tableA where Action = 'INSERT' ....and I think...
16
17017
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
2
21383
by: Tinius | last post by:
I am trying to update a field of type IMAGE. I am able to do this by deleting the record and then INSERTing a new record as shown below in the commented section. But I really want to do this with an UPDATE command as shown below in the un-commented code. I assume this is possible. The image is passed as a byte array called 'content'. I then want to update the column STREAM with the new 'CONTENT'.
25
4071
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
3
3451
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all the necessary records in it when testing it. I get the error "No value given for one or more required parameters." when I try to update the database. Can you tell me what am I doing wrong?
1
6210
by: abhi81 | last post by:
Hello All, I have a table on which I have created a insert,Update and a Delete trigger. All these triggers write a entry to another audit table with the unique key for each table and the timestamp. Insert and Update trigger work fine when i have only one of them defined. However when I have all the 3 triggers in place and when i try to fire a insert query on the statement. It triggers both insert and update trigger at the same time and...
13
1888
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post by:
I am using VS2005. I created a Windows Appication project. Inside the Server Explorer, I created a new SQLExpress database, and then created a new table. I added the rows, making my first row an integer, and setting the identity property to true. I set that row to be my primary key. I then added a dataset, and added my table to the dataset. When I configure the table, I have no Update or Delete commands, even though the wizard has the...
0
2290
by: magnolia | last post by:
i created a trigger that will record the changes made to a table .everything works fine except the insert query.whenerever i try to insert a record it fires insert and update triger at the same time which means i hav 2 record for every insert operation. any help appreciated. thank u herez teh code i tried. ALTER TRIGGER trg_ContactAddress_Audit ON Address FOR DELETE, INSERT, UPDATE AS
0
8896
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9451
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9421
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4771
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2872
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2284
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.