Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 02 May 2008 @ 00:04:02 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Retrieving the Second Highest Amount
 
From:   Dieter Noeth

Michael Larkins wrote:

  The real question is whether or not the optimizer is acting correctly in its choice regarding the timing of applying the WHERE conditions.  


Of course the optimizer is right, it can only push a condition into a view/derived table, if it's not changing the result set.

Just imagine the condition pushed into a view doing an aggregation, removing rows before the SUM.


  Otherwise, why does the optimizer not always read all rows into spool and then select from spool based on the select from the view.  


If you use a (PARTITION BY customer, cust_date), then it will push a condition on cust_date.

There's no efficient solution (beside Victor's proposition, which will result in a huge cross join/spool) to Megan's problem including all 4 requirements.


Dieter



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023