I have a table with 100,000 rows. I have a col status_cd with possible values of ( 'I' OR 'P'). I want to get min transaction_id of column with value P.
My question is , is it better to have a either
1. Cursor c1 is select * from table where status_cd = 'P'
order by transaction_id desc ;
open cursor and get first row and exit from cursor
2. select min(transcation_id) from table where status_cd = 'P' ;
Which one runs faster and why if i have index on status_cd.
Thanks in advance
Click Here to Expand Forum to Full Width