limit rows

Aster
Teradata Employee

limit rows

When one is using this function in a query in Aster, is a random set of rows returned (assuming there is no order by specification).

Tags (1)
1 REPLY
Enthusiast

Re: limit rows

Yes Sir, Every time limit will pick up randowm rows. But if you run teh same select with limit there are chances you might get a specific result set.

well, the answer in single word is YES, random set of rows are returned while limit is used.

Try for yourself.


create table public.limit_test ( i int, j char(1) ) distribute by hash ( i ) ;

insert into public.limit_test values  ( 1, 'a') ;

insert into public.limit_test values  ( 2, 'b') ;

insert into public.limit_test values  ( 5, 'd') ;

insert into public.limit_test values  ( 4, 'c') ;

insert into public.limit_test values  ( 6, 'e') ;

insert into public.limit_test values  ( 9, 'h') ;

insert into public.limit_test values  ( 8, 'g') ;

insert into public.limit_test values  ( 7, 'f') ;

select * from public.limit_test limit 3;

5 d

8 g

7   f

select * from public.limit_test limit 3;

8 g

5 d

6 e

select * from public.limit_test limit 3;

6 e

1 a

5 d

--- the result set is independent in the order of Inserts performed.