| Tuning suggestions on query [message #605196] | 
			Tue, 07 January 2014 23:41   | 
		 
		
			
				
				
				
					
						
						mohan1760
						 Messages: 59 Registered: June 2008 
						
					 | 
					Member  | 
					 | 
		 
		 
	 | 
 
	
		Hi all, 
 
Any suggestions on tuning below query.
SELECT A.AMT_MATURITY
  FROM AMT_HISTORY A
 WHERE A.ACCT_NO = 100252652    
   AND A.DEP_NO = 5
   AND A.DAT_CALC = (SELECT MAX(DAT_CALC)
                       FROM AMT_HISTORY
                      WHERE COD_ACCT_NO = A.ACCT_NO
                        AND COD_DEP_NO = A.DEP_NO);
Explain plan:
SELECT STATEMENT, GOAL = ALL_ROWS			10	1	100
 FILTER					
  SORT GROUP BY			10	1	100
   HASH JOIN			5	1	100
    TABLE ACCESS FULL	HOST1	AMT_HISTORY	2	1	60
    TABLE ACCESS FULL	HOST1	AMT_HISTORY	2	2	80
 
Thanks in advance.. 
 
*BlackSwan added {code} tags. Please do so yourself in the future. 
		
		
		[Updated on: Tue, 07 January 2014 23:51] by Moderator Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 | 
	| 
		
 | 
	| 
		
 | 
	
		
		
			| Re: Tuning suggestions on query [message #605557 is a reply to message #605284] | 
			Fri, 10 January 2014 08:35   | 
		 
		
			
				
				
				  | 
					
						
						Kevin Meade
						 Messages: 2103 Registered: December 1999  Location: Connecticut USA
						
					 | 
					Senior Member  | 
					 | 
		 
		 
	 | 
 
	
		1. how many rows are in table AMT_HISTORY 
2. how many rows satisfy the query predicates (A.ACCT_NO = 100252652 AND A.DEP_NO = 5) 
3. is there an index on columns (ACCT_NO,DEP_NO,DAT_CALC) 
4. are the above three columns UNIQUE for this table 
 
A query plan is next to useless without the associated PREDICATE INFO.  Please provide both. 
 
Kevin
		
		
		[Updated on: Fri, 10 January 2014 08:36] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |