Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 11 Jan 2001 @ 15:24:48 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: Limited Select
From:   David Wellman

I think Eric's statement is probably true with a simple Select which contains no WHERE clause, only accesses a single table (probably no aggregation and maybe no OLAP functions).

The SAMPLE function always (as far as I know) provides a sample of the answer set for the 'normal' query - i.e. the query as if there was no SAMPLE clause in it. Therefore, if the query is only a simple query, then the optimiser can decide which rows to include in the answer set simply by using the internal indexes.

However, if the query contains a WHERE clause, joins etc then it will build the normal answer set first and THEN apply the sampling function to produce the answer set that is returned to the user. In this case, using the SAMPLE function is unlikely to be any quicker than running the normal query and using application capabilities - e.g. Bteq's RETLIMIT/RETCANCEL or Queryman's "maximum number of rows to display".

BTW - if I'm ever using the Bteq Retlimit function (especially in a production script) I always use the RetCancel function as well. Doing this saves Bteq unnecessarily retrieving and then throwing away all rows after the 'retlimit'.



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