Suppose I have a Select Statement like this...
select a,b,c 
from table1 where d='' 
union 
select a,b,c 
from table1 where d>='' and e='' order by f asc,g desc offset 0 rows 
fetch next 100 rows only 
Lets say I need both the select with the union but the thing is when I do order by with non-primary keys i.e. with f and g it takes a lot of time to execute the query. But when I do the order by with primary keys say a and b it executes faster.
Please suggest me a way where I can execute the above query faster with order by of non-primary keys.
 
     
     
    