Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should get better database performance can allow a server to perform work with it's own data, where possible, rather than having to transmit it back and forth. </p> <p>I will make a few guesses about the circumstances, and if you correct me, I will gladly adjust the answer to fit your situation. This sounds like you are extracting data from an accounting transaction table in DB2, and that when done, you want to update the flag in those same records. That might indicate that the records could stay in that table essentially forever, or perhaps that some other process clears them out. There is no WHERE on your SELECT, so I will assume they do get removed. I will assume that we don't know if more records might get added to the transaction table at any time, including any period between extracting the info and updating the flag. </p> <p>I wonder if you could update the flag immediately upon extraction, before they have actually been processed SQL Server? Would this be allowed logistically, and within your business requirements?</p> <p>Suppose you...</p> <ol> <li>extract the DB2 unprocessed transaction data into a workfile,</li> <li>transfer the workfile to SQL Server, </li> <li>perform whatever processing you want to do in SQL Server</li> <li>tell DB2 to update the transaction table based on the workfile </li> </ol> <p>So in DB2, #1 might look like</p> <pre><code>INSERT INTO workfile SELECT * FROM transactions WHERE flag = unprocessed </code></pre> <p>During step 3, your SQL Server job could update the flag in the workfile to an error status, for any records that SQL Server cannot process properly.</p> <p>Step 4 on DB2 could be</p> <pre><code>UPDATE transactions SET flag = processed WHERE transid IN (SELECT transid FROM workfile WHERE flag &lt;&gt; error ) </code></pre> <p>Hopefully, processing errors on SQL Server would be fairly rare. If that process updates transactions in the workfile, only on an error, this should be faster than transmitting updates for each success. The UPDATE statement above, should be able to to run faster on DB2, since it is driven by the workfile on the same server, rather than data be transmitted back up to DB2.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload