Well, sometimes it works. But it doesn't work always. Launch the code bellow and post here if the output was sorted according the group by clause in ascending order. Mine wasn't in 9i nor in 10g.
Code:create table the_table ( pk1 int, pk2 int, nk1 int not null, nk2 int not null, primary key(pk1,pk2) ) / create index the_table_idx on the_table(pk1,nk1,pk2,nk2) / insert into the_table values (1, 1, 2, 2 ); insert into the_table values (2, 1, 1, 1 ); analyze table the_table compute statistics; set autotrace on explain select nk1, nk2, pk1, pk2, count(*) a_count from the_table group by nk1, nk2, pk1, pk2 ;




Reply With Quote