????????????Oracle??????????????????
???????????? ???????[ 2015/1/5 13:44:04 ] ????????Oracle ????? ???????
	?????????????ЩORACLE SQL??????????????о????????????SQL??????????????????????С???????????????Щ???????????????????
	?????????oracle?????1???????ж???????hash???????????????????????hash join?????;
	?????????oracle?????1???????ж????????????????????????????????order by?????
	???????????????????????????
	
	??????????????????????????sqlplus??У??????????????CPU??????????
	?????????????hash????????????
| 
				 
					declare 
				
					i             integer; 
				
					int1          integer; 
				
					t1            number; 
				
					t2            number; 
				
					t_all         number; 
				
					t_select      number; 
				
					execute_count number := 10; 
				
					function getnumfromtimestamp(iTime timestamp) return number is 
				
					Result        number; 
				
					v_hour        number; 
				
					v_minute      number; 
				
					v_second      number; 
				
					v_millisecond number; 
				
					begin 
				
					v_hour   := EXTRACT(hour from iTime); 
				
					v_minute := EXTRACT(minute from iTime); 
				
					v_second := EXTRACT(second from iTime); 
				
					Result   := (v_hour + 1) * 3600 + (v_minute + 1) * 60 + v_second; 
				
					return(Result); 
				
					end; 
				
					begin 
				
					select /*+use_hash(a??b)*/ 
				
					count(*) 
				
					into int1 
				
					from (select rownum + 20000000 rn from dual connect by rownum <= 1000000) a?? 
				
					(select rownum + 10000000 rn from dual connect by rownum <= 1000000) b 
				
					where a.rn = b.rn; 
				
					t1 := getnumfromtimestamp(systimestamp); 
				
					for i in 1 .. execute_count loop 
				
					select /*+use_hash(a??b)*/ 
				
					count(*) 
				
					into int1 
				
					from (select rownum + 20000000 rn 
				
					from dual 
				
					connect by rownum <= 1000000) a?? 
				
					(select rownum + 10000000 rn 
				
					from dual 
				
					connect by rownum <= 1000000) b 
				
					where a.rn = b.rn; 
				
					end loop; 
				
					t2    := getnumfromtimestamp(systimestamp); 
				
					t_all := t2 - t1; 
				
					select count(*) 
				
					into int1 
				
					from (select rownum + 20000000 rn from dual connect by rownum <= 1000000); 
				
					t1 := getnumfromtimestamp(systimestamp); 
				
					for i in 1 .. execute_count loop 
				
					select count(*) 
				
					into int1 
				
					from (select rownum + 20000000 rn 
				
					from dual 
				
					connect by rownum <= 1000000); 
				
					end loop; 
				
					t2       := getnumfromtimestamp(systimestamp); 
				
					t_select := t2 - t1; 
				
					dbms_output.put_line('hash_times:' || 
				
					trunc(1000 / 
				
					((t_all - t_select) / (2 * execute_count)))); 
				
					end; 
				
					/ 
			 | 
		
?????????????sort????????????
??????
					
					???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44
					
			
								
								
								
								
								
								
								
								
								
								
				
sales@spasvo.com