| 
		
			| updation of 200millions rows [message #389015] | Fri, 27 February 2009 00:18  |  
			| 
				
				
					| junaidsystems Messages: 30
 Registered: June 2006
 | Member |  |  |  
	| Hi, 
 I have added a new column in a table with 200 millions rows and now I want to update this with value 0
 
 I issue the simple command:
 
 update tbale_name set col=0
 
 It is not able to update column even after 7 hours.
 
 Any body have experience like this. I visited many groups and tried many other options such as cursors, etc but problem still there.
 
 regards.
 |  
	|  |  | 
	|  | 
	|  | 
	|  | 
	|  | 
	|  | 
	| 
		
			| Re: updation of 200millions rows [message #389064 is a reply to message #389048] | Fri, 27 February 2009 02:55   |  
			| 
				
				
					| JRowbottom Messages: 5933
 Registered: June 2006
 Location: Sunny North Yorkshire, ho...
 | Senior Member |  |  |  
	| Do you have any On Update triggers on the table - if so, you might want to look at disabling them for this update, or rewriting them to exclude updates to this column. 
 
 |  
	|  |  | 
	|  | 
	|  | 
	|  | 
	|  | 
	|  | 
	|  | 
	|  | 
	| 
		
			| Re: updation of 200millions rows [message #389735 is a reply to message #389165] | Tue, 03 March 2009 07:27   |  
			| 
				
				
					| ahudspith Messages: 26
 Registered: January 2009
 Location: Avoiding the tax man.
 | Junior Member |  |  |  
	| Is the column the last one in the table? 
 If it is then just drop it and recreate the column with a default value.
 
 For gods sake do this in a test system first to see if there is sufficient gain to justify it first tho...
 |  
	|  |  | 
	| 
		
			| Re: updation of 200millions rows [message #389768 is a reply to message #389735] | Tue, 03 March 2009 09:10   |  
			| 
				
				
					| JRowbottom Messages: 5933
 Registered: June 2006
 Location: Sunny North Yorkshire, ho...
 | Senior Member |  |  |  
	| Recreating the column with a default value will be no quicker than doing the update. Here's a test you can run to demonstrate this:
 create table test_127 (col_1  number);
insert into test_127 (select level from dual connect by level <= 1000000);
declare
  v_iter   pls_integer := 10;
  v_time   pls_integer;
  v_tot    pls_integer := 0;
begin
 
  for i in 1..v_iter loop
    v_time := dbms_utility.get_time;
    execute immediate 'alter table test_127 add (col_2 number default 0)';
    v_tot := v_tot + (dbms_utility.get_time - v_time);
    execute immediate 'alter table test_127 drop column col_2';
  end loop;
  dbms_output.put_line('Test 1 '||to_char(v_tot));
  
  v_tot := 0
  for i in 1..v_iter loop
    v_time := dbms_utility.get_time;
    execute immediate 'alter table test_127 add (col_2 number)';
    
    execute immediate 'update test_127 set col_2 = 0';
    v_tot := v_tot + (dbms_utility.get_time - v_time);
    execute immediate 'alter table test_127 drop column col_2';
  end loop;
  dbms_output.put_line('Test 2 '||to_char(v_tot));  
end;
/
 I just ran this and got these results:
 Test 1 150334
 Test 2 142476
 
 Actually, if the OP could run this, and tell us how long it takes, that might be informative.
 |  
	|  |  | 
	|  | 
	|  |