Friends:
Let's say I'd like perform a delete, but before I delete, I'd like to
export the target rows.
I could use an export whose SELECT clause references the OLD TABLE of
a DELETE, but the issue is I'm deleting the table in chunks, like so:
WHILE (V_NO_DATA = 0) DO
DELETE FROM
(
SELECT 1 FROM X FETCH FIRST 200000 ROWS ONLY
) AS X_D';--
COMMIT;--
END WHILE;--
Since EXPORT won't append to the target export file, I'd end up
creating as many exports (and attendant files) as iterations in my
WHILE loop, which is no good.
As I understand it, EXPORT is not under transactional control, so I'm
wondering how I can ensure that I don't delete more rows than I export
(I don't mind deleting fewer, and I suppose intermediate updates are
an issue, either).
To avoid phantom/DR/Non-RR anomalies, would it be enough to specify
the isolation level of the EXPORT's SELECT and the SELECT in the
DELETE as WITH RR?
Anybody tackled this issue before?
(UDB LUW 8.2.3 on AIX 5.x)
--Jeff 6 4095
On May 7, 3:05 pm, jefftyzzer <jefftyz...@sbcglobal.netwrote:
Friends:
Let's say I'd like perform a delete, but before I delete, I'd like to
export the target rows.
I could use an export whose SELECT clause references the OLD TABLE of
a DELETE, but the issue is I'm deleting the table in chunks, like so:
WHILE (V_NO_DATA = 0) DO
DELETE FROM
(
SELECT 1 FROM X FETCH FIRST 200000 ROWS ONLY
) AS X_D';--
COMMIT;--
END WHILE;--
Since EXPORT won't append to the target export file, I'd end up
creating as many exports (and attendant files) as iterations in my
WHILE loop, which is no good.
As I understand it, EXPORT is not under transactional control, so I'm
wondering how I can ensure that I don't delete more rows than I export
(I don't mind deleting fewer, and I suppose intermediate updates are
an issue, either).
To avoid phantom/DR/Non-RR anomalies, would it be enough to specify
the isolation level of the EXPORT's SELECT and the SELECT in the
DELETE as WITH RR?
Anybody tackled this issue before?
(UDB LUW 8.2.3 on AIX 5.x)
--Jeff
Serge's "SQL on Fire" Part II has a promising lead--using a CTE I can
INSERT my DELETEd rows into a temp table and then EXPORT its contents.
That'll solve my isolation issues, but at the expense of INSERTing
into a table (I'd likely use a DGTT though, so the insertion cost
should be minimal).
Any other ideas, though?
--Jeff
jefftyzzer wrote:
Serge's "SQL on Fire" Part II has a promising lead--using a CTE I can
INSERT my DELETEd rows into a temp table and then EXPORT its contents.
That'll solve my isolation issues, but at the expense of INSERTing
into a table (I'd likely use a DGTT though, so the insertion cost
should be minimal).
I have never tried this, but export this query:
SELECT * FROM OLD TABLE(DELETE FROM T ...)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
On May 7, 5:45 pm, Serge Rielau <srie...@ca.ibm.comwrote:
jefftyzzer wrote:
Serge's "SQL on Fire" Part II has a promising lead--using a CTE I can
INSERT my DELETEd rows into a temp table and then EXPORT its contents.
That'll solve my isolation issues, but at the expense of INSERTing
into a table (I'd likely use a DGTT though, so the insertion cost
should be minimal).
I have never tried this, but export this query:
SELECT * FROM OLD TABLE(DELETE FROM T ...)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks for your reply, Serge. This issue is that the delete is in a
loop, as it deletes in chunks of 200K, so I'd end up having to do a
separate EXPORT for every iteration of the loop to capture all rows
deleted. I think the technique of yours that I refer to above will
work, though.
--Jeff
On May 8, 2:24 am, jefftyzzer <jefftyz...@sbcglobal.netwrote:
On May 7, 5:45 pm, Serge Rielau <srie...@ca.ibm.comwrote:
jefftyzzer wrote:
Serge's "SQL on Fire" Part II has a promising lead--using a CTE I can
INSERT my DELETEd rows into a temp table and then EXPORT its contents.
That'll solve my isolation issues, but at the expense of INSERTing
into a table (I'd likely use a DGTT though, so the insertion cost
should be minimal).
I have never tried this, but export this query:
SELECT * FROM OLD TABLE(DELETE FROM T ...)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks for your reply, Serge. This issue is that the delete is in a
loop, as it deletes in chunks of 200K, so I'd end up having to do a
separate EXPORT for every iteration of the loop to capture all rows
deleted. I think the technique of yours that I refer to above will
work, though.
--Jeff
Can you explain why simply performing a single export first, followed
by multiple deletes is unsuitable?
If the table format is such that comma-delimited export output is
feasible, then you could script matching
export and delete commands (creating multiple exported files that you
could later concatenate).
mike wrote:
Can you explain why simply performing a single export first, followed
by multiple deletes is unsuitable?
If the table format is such that comma-delimited export output is
feasible, then you could script matching
export and delete commands (creating multiple exported files that you
could later concatenate).
Good idea. Simply pipe the pretty printed result set to file.
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
On May 8, 1:57 am, mike <_lin...@yahoo.comwrote:
On May 8, 2:24 am, jefftyzzer <jefftyz...@sbcglobal.netwrote:
On May 7, 5:45 pm, Serge Rielau <srie...@ca.ibm.comwrote:
jefftyzzer wrote:
Serge's "SQL on Fire" Part II has a promising lead--using a CTE I can
INSERT my DELETEd rows into a temp table and then EXPORT its contents.
That'll solve my isolation issues, but at the expense of INSERTing
into a table (I'd likely use a DGTT though, so the insertion cost
should be minimal).
I have never tried this, but export this query:
SELECT * FROM OLD TABLE(DELETE FROM T ...)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Thanks for your reply, Serge. This issue is that the delete is in a
loop, as it deletes in chunks of 200K, so I'd end up having to do a
separate EXPORT for every iteration of the loop to capture all rows
deleted. I think the technique of yours that I refer to above will
work, though.
--Jeff
Can you explain why simply performing a single export first, followed
by multiple deletes is unsuitable?
If the table format is such that comma-delimited export output is
feasible, then you could script matching
export and delete commands (creating multiple exported files that you
could later concatenate).- Hide quoted text -
- Show quoted text -
If a user inserts a row after my single EXPORT that I later delete (in
the next step), then I've deleted something I've not archived.
As I mentioned earlier, I have an approach: create a DGTT, insert into
the DGTT the rows I delete (again, in multiple passes) using two
modifying table functions (one for the DELETE the other for the
INSERT), export the contents of the DGTT.
--Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike MacSween |
last post by:
My client has an MS Access database application on her local machine. I have
full access to that in terms of changing the design.
I've got a simple PHP/MySql application on shared hosting, so no...
|
by: steve |
last post by:
hi,
during a full export of my export of a (Release 9.2.0.4.0 - Production )
database i'm getting the following:
I have been thru metalink, and can find nothing that is exactly the same,
even...
|
by: Bridget Willey |
last post by:
I am using ACT 6 and am trying to "split" the database between records
for customers and junk records. The accounts designated as "customers"
have that word in the ID field, and I am using that...
|
by: Danny |
last post by:
Is there a way to use the DoCmd.TransferText to export a database to a text
file but with leaving a field out?
I need the ID field to do one sort before I export.
the spec does not let me...
|
by: Kevin Blakeley |
last post by:
I know this was just posted but I did not want this message to get lost in
the other thread as it's slightly different.
Yes I want to export my dataset to excel for my clients, but I don't want...
|
by: Henry |
last post by:
I have written an ASP/VB.Net application via VS 2003 (Crystal V9) that
uses MS Access 2000 as its database. I can export reports that have no
linked sub reports for printing. However, I'm unable...
|
by: David Richards |
last post by:
Hi,
I was wondering if anyone could help me. I have DataSet that contains
the following data tables Customers, Calls, Quotes, QuoteDetails,
Competitors, Contacts, Notes, and I have setup...
|
by: Fabry |
last post by:
Hi All,
I'm new of this group and I do not know if this is the correct group
for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and...
|
by: DennisBetten |
last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel.
What does this code do:
As the title says, this code is capable of...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |