Showing posts with label cmpcode. Show all posts
Showing posts with label cmpcode. Show all posts

Tuesday, March 20, 2012

Query performance

Can anyone tell me if there‘s a difference how the queries below are treated
by the optimizer
Select A.cmpcode, B.cmpcode
From dbo.oas_docline B
Join dbo.oas_dochead A
On A.cmpcode = B.cmpcode
Where A.cmpcode = 'Microsoft' -- this is the diff
And B.cmpcode = 'Microsoft'
Select A.cmpcode, B.cmpcode
From dbo.oas_docline B
Join dbo.oas_dochead A
On A.cmpcode = B.cmpcode
And A.cmpcode = 'Microsoft'
And B.cmpcode = 'Microsoft'
SUnny
Hi Sanjay
both the queries has the same performance
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
"Sanjay" wrote:

> Can anyone tell me if there‘s a difference how the queries below are treated
> by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
>
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
> --
> SUnny
|||Same same. It doesn't matter if you specify a filter in the FROM or WHERE clause for an inner joins.
It will produce the same result and the optimizer know that, so the optimizer has the same
flexibility to product query plans...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:6B3328C5-B4EC-4A7F-8CDD-3D69BF745067@.microsoft.com...
> Can anyone tell me if there's a difference how the queries below are treated
> by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
>
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
> --
> SUnny
|||Sanjay wrote on Thu, 26 May 2005 03:25:17 -0700:

> Can anyone tell me if theres a difference how the queries below are
> treated by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
If you ever want to compare the query plans, put both into QA with a go
after each statement, click the Show Execution Plan on the Query menu, and
run them both. Then look at the Execution Plan tab to see how they compare.
There are probably better ways to check, but I'm still learning the
intricacies of SQL Server DBA.
Dan

Query performance

Can anyone tell me if thereâ's a difference how the queries below are treated
by the optimizer
Select A.cmpcode, B.cmpcode
From dbo.oas_docline B
Join dbo.oas_dochead A
On A.cmpcode = B.cmpcode
Where A.cmpcode = 'Microsoft' -- this is the diff
And B.cmpcode = 'Microsoft'
Select A.cmpcode, B.cmpcode
From dbo.oas_docline B
Join dbo.oas_dochead A
On A.cmpcode = B.cmpcode
And A.cmpcode = 'Microsoft'
And B.cmpcode = 'Microsoft'
--
SUnnyHi Sanjay
both the queries has the same performance
--
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
---
"Sanjay" wrote:
> Can anyone tell me if thereâ's a difference how the queries below are treated
> by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
>
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
> --
> SUnny|||Same same. It doesn't matter if you specify a filter in the FROM or WHERE clause for an inner joins.
It will produce the same result and the optimizer know that, so the optimizer has the same
flexibility to product query plans...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:6B3328C5-B4EC-4A7F-8CDD-3D69BF745067@.microsoft.com...
> Can anyone tell me if there's a difference how the queries below are treated
> by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
>
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
> --
> SUnny|||Sanjay wrote on Thu, 26 May 2005 03:25:17 -0700:
> Can anyone tell me if there?s a difference how the queries below are
> treated by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
If you ever want to compare the query plans, put both into QA with a go
after each statement, click the Show Execution Plan on the Query menu, and
run them both. Then look at the Execution Plan tab to see how they compare.
There are probably better ways to check, but I'm still learning the
intricacies of SQL Server DBA.
Dan

Query performance

Can anyone tell me if there‘s a difference how the queries below are treat
ed
by the optimizer
Select A.cmpcode, B.cmpcode
From dbo.oas_docline B
Join dbo.oas_dochead A
On A.cmpcode = B.cmpcode
Where A.cmpcode = 'Microsoft' -- this is the diff
And B.cmpcode = 'Microsoft'
Select A.cmpcode, B.cmpcode
From dbo.oas_docline B
Join dbo.oas_dochead A
On A.cmpcode = B.cmpcode
And A.cmpcode = 'Microsoft'
And B.cmpcode = 'Microsoft'
SUnnyHi Sanjay
both the queries has the same performance
best Regards,
Chandra
http://chanduas.blogspot.com/
http://groups.msn.com/SQLResource/
---
"Sanjay" wrote:

> Can anyone tell me if there‘s a difference how the queries below are tre
ated
> by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
>
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
> --
> SUnny|||Same same. It doesn't matter if you specify a filter in the FROM or WHERE cl
ause for an inner joins.
It will produce the same result and the optimizer know that, so the optimize
r has the same
flexibility to product query plans...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Sanjay" <Sanjay@.discussions.microsoft.com> wrote in message
news:6B3328C5-B4EC-4A7F-8CDD-3D69BF745067@.microsoft.com...
> Can anyone tell me if there's a difference how the queries below are treat
ed
> by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
>
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
> --
> SUnny|||Sanjay wrote on Thu, 26 May 2005 03:25:17 -0700:

> Can anyone tell me if theres a difference how the queries below are
> treated by the optimizer
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> Where A.cmpcode = 'Microsoft' -- this is the diff
> And B.cmpcode = 'Microsoft'
> Select A.cmpcode, B.cmpcode
> From dbo.oas_docline B
> Join dbo.oas_dochead A
> On A.cmpcode = B.cmpcode
> And A.cmpcode = 'Microsoft'
> And B.cmpcode = 'Microsoft'
>
If you ever want to compare the query plans, put both into QA with a go
after each statement, click the Show Execution Plan on the Query menu, and
run them both. Then look at the Execution Plan tab to see how they compare.
There are probably better ways to check, but I'm still learning the
intricacies of SQL Server DBA.
Dan