SQL optimization

  • how to optimize following qry which running on tables with million records

    select * from tab1 where ID not in (select ID from tab2)

     

     

  • Use left outer join, and filter out the match pairs

    select t1.* from tab1 t1

    left outer join tab2 t2 on t2.ID=t1.ID

    where t2.ID is null

    Hope this would help

    Thanx

     

  • Do you really need to retrieve EVERYTHING? (SELECT *)

    If not, change the * to a list of the columns that you really need.

     

    -SQLBill

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply