sql - Is there any chance to rearrange the execution plan manually? -


i have 2 tables,

  1. need
  2. needcategory

need table has clusted index on needid column, , needcategory have composite clustered index on needid , categoryid.

now take on following query , execution plan query.

 select n.needid,n.needname,n.providername        dbo.need n        join dbo.needcategory nc          on nc.needid = n.needid        isactive=1         , categoryid= 2   order needname 

execution plan

  • clustered index scan on need table happens isactive= 1.

  • clustered index scan on needcategory table happens categoryid=2

my question is,

  1. why scan happens before join occurs? if happens after join filter lighter. if optimizer chooses scan execute first.
  2. is there chance rearrange execution plan manually?

thanks in advance

no not lighter after join.

why think lighter after join?

why think better match on nc.needid = n.needid then filter?
if filter first never have match nc.needid = n.needid going eliminated anyway.

that relatively cheap merge join thing.

lets matching socks shoes , want red socks. why match blue sock shoes , eliminate it.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -