Thursday, December 22, 2005

learn to use execution plan and compound index



execution plan when no compound index:





above query takes 3 second when no index, when indexed with following. resulted in 1 second. create a compound index, WHERE(InvoiceNo) clause first then ORDER(PaymentSortOrder Descending)


execution plan with compound index:



Notes:

in the first execution plan(no compound index), most of time is spent in Sorting, on second execution plan(with compound index), Bookmark Cluster Index is used for looking up the latest payment as of the date

0 Comments:

Post a Comment

<< Home