Friday, March 30, 2012

replacing join operation in XML

is it possible to replace join type ( for eg. nested loop with hash
join and so on) in xml plan...
we will fst take plan in xml format ( show xml plan ) and then we will
replace join with other one .. and then execute this plane .. to see
the effect...
for this we need to understand the way join information get stored in
xml ...and then replace...
for any extra info we can put garbage .. which will be filled by
actual value while execution...
so my question is : is it possible...( i think it is very much
possible)
and if yes then guide me... from where i can get these join
format .. so that i can replace...
or just running query on some dataset for both join type and thn
comparing the way the get stored .. is sufficient to convert...
thankxHi
"Preeti.s83@.gmail.com" wrote:

> is it possible to replace join type ( for eg. nested loop with hash
> join and so on) in xml plan...
> we will fst take plan in xml format ( show xml plan ) and then we will
> replace join with other one .. and then execute this plane .. to see
> the effect...
You can use JOIN hints to force a specific type of join.
e.g.
USE ADVENTUREWORKS
GO
DBCC DROPCLEANBUFFERS
GO
DBCC FREEPROCCACHE
GO
SET SHOWPLAN_XML ON
GO
SELECT *
FROM HumanResources.Employee E
INNER JOIN HumanResources.EmployeeAddress A ON E.EmployeeID = A.EmployeeID
/* Should be merge join */
SELECT *
FROM HumanResources.Employee E
INNER HASH JOIN HumanResources.EmployeeAddress A ON E.EmployeeID =
A.EmployeeID
/* Will be hash join */
SET SHOWPLAN_XML OFF

> for this we need to understand the way join information get stored in
> xml ...and then replace...
> for any extra info we can put garbage .. which will be filled by
> actual value while execution...
Showing the plan is not the same as storing it. You can not change the
output from the SHOWPLAN to effect the way a query is executed.

> so my question is : is it possible...( i think it is very much
> possible)
> and if yes then guide me... from where i can get these join
> format .. so that i can replace...
> or just running query on some dataset for both join type and thn
> comparing the way the get stored .. is sufficient to convert...
> thankx
>
Hopefully I have understood your question!
John

No comments:

Post a Comment