How can I rewrite this update stmt to improve its poor performance?
Hi,
I have the following update stmt that runs for over 6 hours. Here is the SQL and its plan:
UPDATE TABLE1
SET mainveh = 'Y'
WHERE (comp#,polnum,a8dtef,a8deef,a8dtac,
DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
IN (SELECT comp#,polnum,a8dtef,a8deef,a8dtac,
MAX(DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
FROM TABLE1
GROUP BY comp#,polnum,a8dtef,a8deef,a8dtac);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
| 0 | UPDATE STATEMENT | | 1 | 108 | | 798K (1)|
| 1 | UPDATE | TABLE1 | | | | |
| 2 | HASH JOIN | | 1 | 108 | 1079M| 798K (1)|
| 3 | TABLE ACCESS FULL | TABLE1 | 21M| 834M| | 224K (1)|
| 4 | VIEW | VW_NSO_1 | 21M| 1364M| | 440K (1)|
| 5 | SORT GROUP BY | | 21M| 794M| 2453M| 440K (1)|
| 6 | TABLE ACCESS FULL| TABLE1 | 21M| 794M| | 224K (1)|I'm using Oracle 10.2.0.3. The TABLE1 table has 21 million rows. The update stmt will update about 15 million rows. How can I rewrite this update stmt so it'll perform better? There is a primary index on all the columns selected in the subquery. That is the only index on TABLE1.
Thank you!
Edited by: user6053424 on Jul 21, 2010 6:59 AM
Hi,
Thank you for your suggestions. There is an index on the columns in the group by, it is the PK index on TABLE1. I'm suspecting that due to the amount of data to update, the optimizer decided that full table scan is cheaper than index scan. I'm very interested in the GTT idea, but still need some help if I decide to create a GTT from the subquery, because if I just do this:
create global temporary table table1_tmp
on commit preserve rows
as SELECT comp#,polnum,a8dtef,a8deef,a8dtac,
MAX(DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
FROM TABLE1
GROUP BY comp#,polnum,a8dtef,a8deef,a8dtac;then the original update stmt still has the DECODE and such in it, I'm not sure how much benefit that'll do to us:
UPDATE TABLE1
SET mainveh = 'Y'
WHERE (comp#,polnum,a8dtef,a8deef,a8dtac,
DECODE(everif,'Y',10000,0)+auunit*100+vrcdsq)
IN (SELECT comp#,polnum,a8dtef,a8deef,a8dtac,???
FROM TABLE1);Your input is greatly appreciated! Thanks!
Similar Messages
-
How can i rewrite this code into java?
How can i rewrite this code into a java that has a return value?
this code is written in vb6
Private Function IsOdd(pintNumberIn) As Boolean
If (pintNumberIn Mod 2) = 0 Then
IsOdd = False
Else
IsOdd = True
End If
End Function
Private Sub cmdTryIt_Click()
Dim intNumIn As Integer
Dim blnNumIsOdd As Boolean
intNumIn = Val(InputBox("Enter a number:", "IsOdd Test"))
blnNumIsOdd = IsOdd(intNumIn)
If blnNumIsOdd Then
Print "The number that you entered is odd."
Else
Print "The number that you entered is not odd."
End If
End Sub873221 wrote:
I'm sorry I'am New to Java.Are you new to communication? You don't have to know anything at all about Java to know that "I have an error," doesn't say anything useful.
I'm just trying to get you to think about what your post actually says, and what others will take from it.
what does this error mean? what code should i replace and add? thanks for all response
C:\EvenOdd.java:31: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=true;
^
C:\EvenOdd.java:35: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=false;
^
2 errors
Telling you "what code to change it to" will not help you at all. You need to learn Java, read the error message, and think about what it says.
It's telling you exactly what is wrong. At line 31 of EvenOdd.java, you're calling isOdd(), with no arguments, but the isOdd() method requires an int argument. If you stop ant think about it, that should make perfect sense. How can you ask "is it odd?" without specifying what "it" is?
So what is this all about? Is this homework? You googled for even odd, found a solution in some other language, and now you're just trying to translate it to Java rather than actually learning Java well enough to simply write this trivial code yourself? -
The next time it happens, I'll append the error message, and more details, but essentially after downloading something an alert box appears stating that Firefox cannot complete the update because it can't install the update. No reason given or actually even a name for the update.
The next time it happens, I'll append the error message, and more details, but essentially after downloading something an alert box appears stating that Firefox cannot complete the update because it can't install the update. No reason given or actually even a name for the update.
-
i have tried to rewrite this code but keep getting errors. ive read loads of tutorials on actionperformed and mouseclicked i just need som1 to point me in the right direction
heres the code
public boolean mouseUp(Event e, int x, int y){
if (y == 0)
swit = true;
return true;
//else
if (pics[getMC(x,y)].getID() > rw*col/2){
return true;}
if (0 == track)
card1 = pics[getMC(x,y)];
start = new Date();
etime.start();
track = 2;
stat = "pic again";
repaint();
return true;
if (1 == track){
card1 = pics[getMC(x,y)];
track = 2;
stat = "pick again";
repaint();
return true;
else if (2 == track)
if (card1 == pics[getMC(x,y)]) return true;
card2 = pics[getMC(x,y)];
track = 3;
attempts++;
if (card1.getID() == card2.getID())
stat = "well done";
matched++;
if (rw*col/2 == matched)
stat = "finished";
etime = null;
else
stat = "Try Again";
repaint();
return true;
else
return false;
}Hi,
Do you want your code to listen to different Mouse events? and what other events?
ex:
copy the content of the below link and run the application
http://java.sun.com/docs/books/tutorial/uiswing/examples/events/MouseEventDemoProject/src/events/MouseEventDemo.java
http://java.sun.com/docs/books/tutorial/uiswing/examples/events/MouseEventDemoProject/src/events/BlankArea.java
If you have any problem with the code; please let us know
Regards,
Alan Mehio
London,UK -
Can someone please tell me how to get this new horrible update off my phone?? It is not user friendly!
Jimmy tomb wrote:
Can someone please tell me how to get this new horrible update off my phone?? It is not user friendly!
That's unfortunate. Go to http://www.apple.com/feedback/ and leave Apple feedback about iOS 7. -
How can we rewrite this query for better performance
Hi All,
The below query is taking more time to run. Any ideas how to improve the performance by rewriting the query using NOT EXITS or any other way...
Help Appreciated.
/* Formatted on 2012/04/25 18:00 (Formatter Plus v4.8.8) */
SELECT vendor_id
FROM po_vendors
WHERE end_date_active IS NULL
AND enabled_flag = 'Y'
and vendor_id NOT IN ( /* Formatted on 2012/04/25 18:25 (Formatter Plus v4.8.8) */
SELECT vendor_id
FROM po_headers_all
WHERE TO_DATE (creation_date) BETWEEN TO_DATE (SYSDATE - 365)
AND TO_DATE (SYSDATE))
ThanksTry this one :
This will help you for partial fetching of data
SELECT /*+ first_rows(50) no_cpu_costing */
vendor_id
FROM po_vendors
WHERE end_date_active IS NULL
AND enabled_flag = 'Y'
AND vendor_id NOT IN (
SELECT vendor_id
FROM po_headers_all
WHERE TO_DATE (creation_date) BETWEEN TO_DATE (SYSDATE - 365)
AND TO_DATE (SYSDATE))
overall your query is also fine, because, the in this query the subquery always contain less data compare to main query. -
HT6065 how can i unistall the update
How can I uninstall this update? i have an application for my powerpoint presentations that do not work because of this update
How to revert OS X back from Mavericks: Apple Support Communities
-
When Im opening raw files in Photoshop They open as a small tile on the desktop.
How can I change this?? please help its very frustrating!Mac OS X: Double-Clicking a File Opens the Wrong Application - http://support.apple.com/kb/TS2291
-
i had my ipad stolen. I set it to remote wipe when next switched on. It came on yesterday and was wiped, but it did not tell me its last location. How can I find this out.
I beive that its too late now if the iPad has been wiped. The means of communicating with the device has been reset so there's no talking to it now.
-
In the iTunes window, when I update my nano ipod, I get an error message "User ipod cannot be updated. The disk could not be read from or written to." How can I overcome this error message.
Hello there dilip77707,
It sounds like you are getting this error message that your iPod cannot be read from or written to when you are trying to update your iPod Nano. I recommend the troubleshooting from the following article to help you get that resolved. Its pretty straight forward, just start at the top and work your way down as needed:
'Disk cannot be read from or written to' when syncing iPod or 'Firmware update failure' error when updating or restoring iPod
Thank you for using Apple Support Communities.
All the very best,
Sterling -
I have recently updated my CC programs to the latest version (CC2014) and now all of my files wont open by default into their respective programs, only if I open the program and go to file>open and open the file from there. How can I fix this?
I have tried 'Open with' and the version of the program now installed on my computer isn't even suggested as an option and when I browse for it, the file wont open with it anywayOn Windows (don't know about Mac), the latest version will always take over the file association, and become the default for indd files. It's impossible to change it.
But there is a plugin for ID that makes this possible. Never tried it myself.
https://www.rorohiko.com/wordpress/downloads/lightning-brain-soxy/ -
how can i fix my iphone i can't update or download apps, when i try it tells me toput my credit card info and i do but when i push done it tells me my payment has been declined, but why do i have to pay to update or download free apps. How can i fix this?
You must contact iTunes support to get the problem resolved.
http://www.apple.com/support/itunes/contact/
If there is a problem with your account or payment info, you cannot
download anything (including free apps or updates) until the matter
is resolved.
In countries where the iTunes Store only sells apps, the accepted payment methods are Visa, MasterCard, and American Express. Other payment types such as gift cards, store credit, monthly allowances, ClickandBuy, and PayPal are not accepted. Depending on your App Store country, prices may be listed in your local currency, US Dollars, or Euros. http://support.apple.com/kb/HT5552 -
Hello i have one IPhone 4S and I use 3G net in my mobile sometime I have problem with temperature in my phone at the SIM card or battery how can I fix this problem. By update or version of 6.1.3
Could it be because the SIM card got damaged while I cut it to fit the IPhone?
Very likely. Hard to believe the carrier in Mexico doesn't have a micro-SIM card available.
Or somehow the Chinese carrier found out and locked it?
No, which is not possible.
What can I do? Get a new SIM and see if it works again?
Get a micro-SIM from the carrier in Mexico that you don't have to manually cut down. If that carrier doesn't provide one, switch to another carrier that is not so low-budget. -
Today while driving home from vacation i purchased and downloaded the new Nichleback CD, when i got home, i plugged my phone into my computer to update everything and it pulled up a message saying something like "this computer has recognized an iPhone that is in memory update, you will need to restore the phone" or something similar to that, it had a picture of the power cord plugging into iTunes on the screen and i couldn't get rid of it, so i had to plug it in and restore everything, when it was done i noticed that not only did i loose the new CD that i had just purchased today but i lost all of the music that i've purchased since the last update. How can i restore this music without purchasing it all again?
Media should be included with the backup of the computer that all users should be creating on a regular basis as part of basic computer/data maintenance.
In the event that you do not have a backup (stop being lazy.... keep backups of YOUR data and other important files)
If you are in the US and running iTunes 10.3 or later, it is possible to redownload music via iCloud from purchased history.
If you are not in the US or for some reason cannot run iTunes 10.3 or later, contact iTunes customer support and ask very nicely for the opportunity to redownload the content. They are not required to provide this opportunity.
It is also possible to transfer content from an iDevice that was purchased via iTunes. On the new computer, sign into the iTunes account, authorize the computer, connect the device then select File > Transfer Purchases.
The simplest method of all is to transfer or copy the media (and other important files) from the old computer or the backup of the old computer. Typing "move itunes library" into the search bar here or into google will reveal step by step instructions on how to do this. -
I have iTunes, latest version, open in Windows XP and get an error 45048 message when I try to update apps thru the store. How can I fix this? I have reinstalled iTunes twice but problem continues.
Try contacting iTunes via email to check if there is an issue with the account. go to apple.com/support/itunes
Click on iTunes Store account and billing and select inquiries. On the right side click on "email us".
Before doing that trying viewing your account information first. Open the iTunes on you mac, look at the menu and select store and select view my account. Try removing the card (this is only applicable if you don't have a pending charges with iTunes) and hit done. Sign out, quit iTunes and sign back in and try updating the apps again.
Maybe you are looking for
-
Siebel Sales Rep Visibility in BI Publisher, Bug???
Hi, I have run into an issue with a bi publisher report in Siebel 8.1.1.0 and BI Publisher 10.1.3.4.0 where there is a Siebel View with a Visibliity Applet Type = Sales Rep. The data showing in the report on this view is not filtered according to "Sa
-
What type of adapter/ converter would I purchase from Apple if traveling to France? Does Apple even offer one?
-
Problem in Changing Vehicle data Using BAPI "BAPI_VEHICLE_CHANGE_MULTIPLE"
I am using BAPI_VEHICLE_CHANGE_MULTIPLE to change the vehicle data but every time i am getting the message in return table " " . If any one has some exp. with this function module then please help me in this. Thanks in advance. Gaurav
-
Dual Core G5 using only one CPU
Anyone has an idea about what happened to me last week? Here is what happened: I let my dual 2.3 GHz Power Mac G5 run over night to run a certain task. When I came back the following morning, the fans were running like crazy and the computer was froz
-
Which of these would be the best iMac for video editing?
Hello, pretty simple question, which of these 2 iMac configurations would be best suited for video editing? I want to use Final Cut Pro X and Adobe After Effects (not cutting edge effects just simple stuff). Option 1 - 21.5 inch 3.1GHz Quad-core Inte