Update Clause (can These Queries be more tunned)
Can anyone suggest me on following Queries which we can write in some other fashion (in line view, etc..) or can it be more optimised or multiple select can be minimised. I anted to reduce time of these updates. Its taking more time to update. I have tried For Loop, cursors, but still taking more time.. I have also created indexes. But it reduced hardly any time.
I have also attached execution plan for the same..
No. : 1
UPDATE cbr_fw_acct_mast A
SET A.bal_eod = (SELECT b.bal_principal
FROM ol_td_aux_table@fwdat B
WHERE b.cod_acct_no = a.cod_acct_no
AND b.dat_post = var_l_dt_process
AND b.dat_txn = (SELECT MAX(c.dat_txn)
FROM ol_td_aux_table@fwdat c
WHERE b.cod_acct_no = c.cod_acct_no
AND c.dat_post = b.dat_post)
AND b.ctr_batch_no = (SELECT MAX(c.ctr_batch_no)
FROM ol_td_aux_table@fwdat c
WHERE b.cod_acct_no = c.cod_acct_no
AND c.dat_post = b.dat_post
AND b.dat_txn = c.dat_txn)
AND b.ref_sys_tr_aud_no = (SELECT MAX(c.ref_sys_tr_aud_no)
FROM ol_td_aux_table@fwdat c
WHERE b.cod_acct_no = c.cod_acct_no
AND c.dat_post = b.dat_post
AND b.dat_txn = c.dat_txn
AND b.ctr_batch_no = c.ctr_batch_no)
AND b.ctr_updat_srlno = (SELECT MAX(c.ctr_updat_srlno)
FROM ol_td_aux_table@fwdat c
WHERE b.cod_acct_no = c.cod_acct_no
AND c.dat_post = b.dat_post
AND b.dat_txn = c.dat_txn
AND b.ctr_batch_no = c.ctr_batch_no
AND b.ref_sys_tr_aud_no= c.ref_sys_tr_aud_no) )
WHERE A.cod_prod_category = 'TD'
AND EXISTS (SELECT DISTINCT cod_acct_no
FROM ol_td_aux_table@fwdat
WHERE dat_post = var_l_dt_process
AND A.cod_acct_no = cod_acct_no)
AND A.cod_acct_stat = 5;
Query Plan
UPDATE STATEMENT Cost =
UPDATE CBR_FW_ACCT_MAST
FILTER
TABLE ACCESS BY INDEX ROWID CBR_FW_ACCT_MAST 1
INDEX RANGE SCAN IN_CBR_FW_ACCT_MAST_2 NON-UNIQUE
REMOTE
FILTER
REMOTE
SORT AGGREGATE
REMOTE
SORT AGGREGATE
Query Plan
REMOTE
SORT AGGREGATE
REMOTE
SORT AGGREGATE
REMOTE
No. : 2
UPDATE cbr_fw_acct_txns A
SET A.cod_cc_atm_brn = (SELECT RTRIM(B.ca_name)
FROM xf_ol_st_cotxn_mmdd@fwdat B
WHERE B.cod_acct_no = A.cod_acct_no
AND B.dat_post_stl = var_l_dat_process
AND B.dat_txn_stl = A.dat_txn
AND B.ctr_batch_no = A.ctr_batch_no
AND B.ref_sys_tr_aud_no = A.ref_sys_tr_aud_no
AND B.ref_subseq_no = A.ref_sub_seq_no
AND B.cod_txn_mnemonic = A.cod_txn_mnemonic
AND B.cod_msg_typ = A.cod_msg_typ
AND B.cod_reply = 0
AND B.fwd_inst_id = '00000009900')
WHERE ( A.cod_acct_no, A.dat_post, A.ctr_batch_no
, A.ref_sys_tr_aud_no, A.cod_txn_mnemonic, A.cod_msg_typ ) IN
( SELECT cod_acct_no, var_l_dat_process, ctr_batch_no,
ref_sys_tr_aud_no, cod_txn_mnemonic, cod_msg_typ
FROM xf_ol_st_cotxn_mmdd@fwdat
WHERE dat_post_stl = var_l_dat_process
AND cod_reply = 0
AND fwd_inst_id = '00000009900' ) ;
Query Plan
UPDATE STATEMENT Cost =
UPDATE CBR_FW_ACCT_TXNS
NESTED LOOPS
VIEW VW_NSO_1
SORT UNIQUE
REMOTE
TABLE ACCESS BY INDEX ROWID CBR_FW_ACCT_TXNS 1
INDEX RANGE SCAN IN_CBR_FW_ACCT_TXNS_1 NON-UNIQUE
REMOTE
No. : 3
UPDATE cbr_fw_acct_mast A
SET A.dat_acct_close = ( SELECT MAX(dat_value)
FROM td_audit_trail@fwdat B
WHERE B.cod_acct_no = A.cod_acct_no)
WHERE A.cod_prod_category = 'TD'
AND EXISTS ( SELECT DISTINCT c.cod_acct_no
FROM td_audit_trail@fwdat c
WHERE A.cod_acct_no = c.cod_acct_no)
AND A.cod_acct_stat in (1);
Query Plan
UPDATE STATEMENT Cost =
UPDATE CBR_FW_ACCT_MAST
FILTER
TABLE ACCESS BY INDEX ROWID CBR_FW_ACCT_MAST 1
INDEX RANGE SCAN IN_CBR_FW_ACCT_MAST_2 NON-UNIQUE
REMOTE
SORT AGGREGATE
REMOTE
Point 1. Querying from remote databases is very difficult to tune. It is also notoriously bad for performance. Running correlated sub-queries against tables in a remote database is bound to be agonisingly slow.
How often do you run these queries? If these are one-offs you should just take the pain but if you are going to be running these queries often it would be worth replacing the remote calls with materalized views on the local database.
Point 2. You don't need DISTINCT with EXISTS. You're introducing an unnecessary sort there. But I don't think that's what's killing you.
Cheers, APC
Similar Messages
-
Since performing the latest update I can no longer use more than three displays.
Does anyone know of a fix for the problem where you can only run 3 monitors? I was running 4 displays before the update but now only three can run. Apple support recognizes the problem but does not have a answer. Anybody else haveing this problem?
Yes, see:
https://discussions.apple.com/thread/6224241?tstart=0
10.9.3 kills third monitor: Apple Support Communities -
Hi,
If you are using Forte as 2-tier tools, there shouldn't be any problem in
using select ... for update. The sql is actually passed through to your
back-end database. So everything should work the same, provided that every
user has his own database session ( like by using DBResourceMgr to create
DBSession at run-time for each user. )
However, if you are building multi-tier application, there is no simple
answer to your question. The problem is common to all 3-tier application
since the application / database layer is shared among many users. If you
start a transaction from client side, use select ... for update to lock a
record, allow user to change data, then update and end the transaction, you
are not just locking up a record, but also a database session. In such
model, you will run out of DBSession very soon.
What we did here is to use a "lock count", which exists is every table.
When client retrieves a record, it won't start a transaction there. A
transaction is started only on the server and after client commits its
changes to the server. Data consistency is checked by checking the lock
count in the update where clause.
It looks dumb, but it's the only solution that we can reach after consulting
a lot of white paper and Forte consultants. Moreover, Forte consultant also
said its bad to start a transaction on client side.
I do hope that there is a better solution out there in handling 3-tier
applications too. Afterall, this lock count thing is clumsy.
Peter Sham.
-----Original Message-----
From: Phong Tran [SMTP:[email protected]]
Sent: Thursday, March 18, 1999 6:50 AM
To: [email protected]
Subject: for update clause
dear forte-users,
I notice the "for update" clause can only used with cursor.
Just wonder why you can not use it with "sql select ...." statement.
Also as I understand it, one way to protect the data consistency is
through
the mutex lock but then you turn the object to a single-threaded to
serialize access even though you access different rows in a
database
table. The fact is you only want access on a particular row.
Does anyone know the best way to lock a row (or rows) in the
database ?
If you have to rely on the "for update" clause in the cursor
definition for
the locking, then you almost end up with a lot of cursors.
Example: the method ReadnWriteDB(ordeId) accesses a specific row
but since the orderOBj serializes access, other tasks have to wait.
OrderObj: OrderMgr = new(IsShared = TRUE, IsTransactional = TRUE);
method GetOrderInfo() of the TransactionSO.
begin transaction
OrderObj.ReadnWriteDB(orderId);
end transaction;
From Client:
Begin
start task TransactionSO.GetOrderInfo(orderId);
end;
Phong
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Which application front end are you using.
Also, you'll get the same error if your Query runs too long, and/or your rollbacks are too small. -
TS1436 Since the last I-tunes update I can't create new playlists or burn cd'sfor my car
Since the last i-tunes update I have lost the ability to create new playlists as well the option to burn a new cd. I ued to be able to click "File" and go from there. The file option is gone since the new update.
How can I test the other display theory? I didn't connect any new monitor (I do use 2) but I occasionally use stuff like remote desktop tools.
I'll try and update the display drivers (even tho I updated them recently).
P.S.: opening it on the other monitor worked. What the heck. Any way I can make it work on both monitors?
I'll be making more tests in the meanwhile. -
my sister has a mac and i want to update my phone onto the computer but i dont want her to see all my stuff can you somehow have more than one itunes account on the same macbook so my stuff with save?
How to use multiple iPhone, iPad, or iPod devices with one computer. The only way is for you to have a separate user account to log into on that computer.
-
I have 2 apple ID one for Egypt and other for USA , now I try to update the software but I get a message said that this software download with other ID, then I logout and sign with second ID but i got the same message again ... Now I can not sign in more
Any solution ?
I'm using iOS 6.1.2 IPad 3
RegardsI have also noticed the same "problem". I do not fully understand the impact of using the same ID on multiple computers and devices if I want to keep them all in sync.
-
# Question
Why can't I minimize more than 2 notepads in FF? I used to be able to minimize as many notepads as I wanted. When I do research on a topic I keep many notepads open until I am finished. FF must have done an update & now I can't do that anymore. Is there a setting I can change that will enable me to do that again?
Also at that time, the length of sentence I am typing changed.
It doesn't seem to have any limit to how far it can extend to the right.
Please help. I am not very techy & don't understand Computerese.
Please explain in everyday English.
Thanks in advance,
posyHi Prabhuti,
Thank you so much for all your suggestions & helpful links to get help. I am not very computer literate. I have taken many classes over the years I've had a computer but I am still only a beginner.
I want to tell you that I found a solution to my problem. I finally realized that maybe FF was not the problem but Wind. 7 on my new comp. I went on the 7 Forums & found another person who had the same problem & the answer was simple all I had to do was to right click on the Notepad icon & it would bring up a new Notepad & I could open & minimize as many as I want. I had moved the Notepad icon to my taskbar from the Start menu when I got my new computer.
I have one more question for you. The notepad 2 program was mentioned there along with several others. I think it was about that prog. that someone said that it could open many notepads & when you closed the comp. the notepads would not disappear. Do you know if it was that program? Also is it possible to use that program the same way as I used the original Notepad? There are so many technical options on that program that I didn't understand. All I want to do is open the Notepad & copy & paste my notes in it & minimize them. Not losing them if I shut down the comp. would be real benefit to me. I believe that is the same prog. you recommended to me. Since you seem to understand tech things I thought maybe you could tell me if that is possible?
Thank you so much for all your help.
posy -
HT1766 all my contacts have been deleted from an update. how can i get these restored?
all my contacts have been deleted from an update. how can i get these restored?
The iphone is designed to be synced to your computer regularly. Your contacts will be in whatever program ( outlook, address book, etc) that you have been synxing. Sync them back.
If you have failed to sync them, then they are likely gone. You can try restoring from backup. -
Why can't I use I tunes card buy more storage on I cloud
How can I use my I tunes card to pay for more storage on I cloud ???
Because you must use a credit or debit card to pay for iCloud storage.
iTunes gift cards are for music, movies, TV shows, apps, and audiobooks. -
hello,i have updated to the new 11,and now i tunes will not open,error pops up,says Data Execution Prevention,and other error we can not complete ur i tune request,unknown error 4002,i have uninstalled and reinstalled ,has been no help.
- Try restoring on another computer.
- Make an appointment at the Genius Bar of an Apple store.
Apple Retail Store - Genius Bar -
I have just done the iso update now its saying connect to i tunes buot i dont have a laptop how can i get around this?
You can't get around it. It must be restore using iTunes on a computer. If you don't have access to one, make an appointment at the genius bar of your local Apple Store.
-
I've had 2 Iphone 6plus stolen last 2 weeks. I am a reasonably careful 50 years old who's had a cell phone since they exist. Surely Apple can think of a way to make these stolen phones more difficult to re-use ? No matter the precautions, a cell phone is easy to steal. But it seems even easier to re-use stolen cell phones. I had "find my phone", passwords, and another tracking device on my second stolen phone. Thieves just shut it off and wipe it. You would think with all the technology available, these phones could be rendered completely useless if stolen. Unless of course this "second hand market" is considered valuable.
Your best bet is to as soon as you realize your device has been stolen is to go to iCloud.com on your computer and put the device in Lost Mode. This gives you the opportunity to not only add a Lock to the screen, but also to send a message to the lowlife who stole you phone, giving them the opportunity to return it, (of course, don't give them any of your personal information!). But you may be able to find a way to communicate with them anonymously via a 3rd party phone or something to see what can be done.
You will be happy to know that your device and its contents cannot be accessed by the thief, and if you don't care for tracking it, you also can also Erase all of your personal information from the device. This does not remove the Activation Lock, so they still won't be able to use it for anything.....
Sorry for your troubles,
GB -
My Partner and i have seperate i tunes accounts,can these be merged into 1 account for ease of use ?
This is not possible.
From Here http://support.apple.com/kb/HE37
I have multiple Apple IDs. Is there a way for me to merge them into a single Apple ID?
Apple IDs cannot be merged. You should use your preferred Apple ID from now on, but you can still access your purchased items such as music, movies, or software using your other Apple IDs. -
HT201269 Can you update 2 I-Phones on one I-Tunes account?
Can you update two I-phones from one I Tunes account?
See this support document http://support.apple.com/kb/ht1495
-
Since last update , I can't see any thing any more
Since last update , I can't see any thing any more, but I can hear sound and music, and I can see my mouse change to the arrow in order to clic. Windows 7, explorer 9, flash player 11.6, I follow your prost it in order to fix it with out go result. What to do? I try to find a previous update for try, but I can't find it.
Thank for readingfadesone28 wrote:
i did the last update 2 days ago with the whole removing older versions of flash and what not, now my whole internet looks different and i cant sign into latest version of yahoo home page for my mail or anything , any help or can i un-update?
You can always revert your system to how it was 2 days ago by reinstalling from your Time Machine Backup. Otherwise I would be having a read through the Yahoo Troubleshooting forums for people who may have a similar problem.
Pete
Maybe you are looking for
-
Looking for an iphone photo editing app that mirrors images?
looking for an iphone photo editing app that mirrors images? Any suggestions? I'd like to mirror an image already in my photo library....
-
YouTube is not working on my macbook pro
Hello, I am using Chrome as my internet browser and when I go to YouTube it does not show the video. I can hear the audio but the box where the video should be is just a blank screen of grey. Does anyone know what may be wrong? And how to fix it? Man
-
Hi, I would like to know if this is possible. I know it's possible to replce a row with another using IMAQ, but I don't want to replace a row in an image but to ADD a row to an image. Is this possible?? Thanks in advance Lennaert
-
Videopodcast audio and video is not syncronized when you download by itunes
Hello Everyone I made some movies with the imovie HD. I publish them using the following settings: video:MP4 H.264, size:320x240, 256kbits/s, 30fps, automatic Audio:AAC 128 kpbs, stereo 44,1khz, superior website:http://itmvodcast.blogspot.com/ URL ht
-
What HTTP status code will client receive if dopost throws an exception?
If my servlet code is written this way: public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException { throw new Exception("Test dopost exception"); }What HTTP status