Showing posts with label strange. Show all posts
Showing posts with label strange. Show all posts

Wednesday, March 28, 2012

I don't see Database Maintenance Planner in my SQL Server Enterorise Manager

Strange..... Anyways, is it possible to add the tool for Database Maintenance Planner to the existing DB installation?

If so, how do I do that? Would someone please help me on this?

Thanks a lot in advance.

Chris.

Hi Chris. If you don't see it, that could mean you aren't logged in as a sysadmin, they are the only logins that are allowed to view/modify maintanence plans.

It should be visible under the Management node in Enterprise manager, then a node called 'Database Maintanence Plans'. You should never see it under a specific database if that's where you are looking, not sure from your post if that may be where you were headed...

As for adding it to an existing installation, that's not really something that ever would need to be done...it's part of all installations, so it should already exist if the installation was successfull to any degree.

HTH,

|||

Having read your kind explanation above, it really make sense!

With confidence backed by your explanation, I will look into the SQL installation (which I did not install myself) and login users on Monday.

Once again, thank you so so so much, Chad. I wish I could buy you a drink!

Chris,

|||No problem Chris, glad to help. Repost if you still continue to have issues finding it...I'd take that drink if I could too!sql

Monday, March 26, 2012

I can't uninstall SQLEXPRESS

Hi all,

I have a strange problem here. How to uninstall SQLEXPRESS when it does not appear in the "Add/remove program"?

Another problem is that I can't connect to the local server using SQL Server Enterprise manager. This is the error that i got:

"a connection could not be established to (My Computer name)\SQLEXPRESS.
Reason: [SQL-DMO]you must use SQL Server 2005 management tools to connect to this server.
Please verify SQL Server is running and check your SQL Server registration properties (by right-clicking on the DHH-MC\SQLEXPRESS node) and try again. "

I do not want to use SQL 2005 because of some issues. All I need is SQL 2000 to run properly.

Can anybody help me in this? Thanks.

When you say you cannot find SQL Express under the Add/Remove Programs window... are you looking specifically for SQL Express? I ask because for some strange reason it appears there as Microsoft SQL Server 2005. If you see that feel free to remove it and the other SQL components installed along with it.|||

I think it is SQL Server 2005 because i have installed it before.

I have uninstalled everything related to the SQL Server 2005 and even SQL Server 2000. But it is still there. SQL Server 2005 is still appeared at the start program.

And when i installed SQL Server 2000, I can't connect to the local server. This is the error:

a connection could not be established to (My Computer name)\SQLEXPRESS.
Reason: [SQL-DMO]you must use SQL Server 2005 management tools to connect to this server..
Please verify SQL Server is running and check your SQL Server registration properties (by right-clicking on the DHH-MC\SQLEXPRESS node) and try again. "

Any solution?

|||

SQL Server 2005 creates a single entry in the Add/Remove programs dialog that collects all the instances of SQL Server 2005. This acutally makes sense as it gives you a place to easily identify the different instances of SQL Server, as we support installing many.

To remove SQL Express, or any other Edition of SQL Server for that matter, go to Add/Remove Programs, select Microsoft SQL Server 2005 and click Remove. You will be taken to a dialog that lists the various components of SQL Server that are installed, including the Instance Names they are installed under. Simply select the components you wish to remove and proceed thorugh the wizard.

Hopefully this clarifies things for you.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

|||Hi. I've got the same problem with unistalling SQL Express with Adavanced Services SP1. I saw it in Add/Remove programs and tried removing it/unistalling it. It DID NOT take me to a dialog with instances installed and options to select which to install or unistall etc.. all that came up was a info box that stated that other SQL Express components depended on that one nad that I should unistall those first. Well I jotted down which and when I tried to uninstall those the same warning/info box came up listing dependent components..so I jotted those down and went around in circles as they were ALL dependent on each other...so, I went ahead and unistalled verything that had MS SQL Server Express/2005 on Add/Remove Programs and it still shows up in my Start menu in the Programs submenu? Also, when I ran the program again to see if an unistall option came up it will only install..so I went along with it to see if an unsiatll option would eventually come up...it didn't..I went far enough along to where it showed me that it STILL had installed instances of SQL Server Epxress? what's with that? anyways, I then cancelled the installation ...man, this almost remindes me of years ago when I first started out doing desktop support and all the problems we had with users when we tried to unistall their AOL from their company machines...I expected better from MS ..I'm dissapointed ...what can I do to get rid of MS SQL Server Express 2005 completely...we were using this machine to possibly build a deployment image for our learning lab ...but if the oprogram is this hideous, we may just have to scrap it..|||

How did you get Express Advanced installed onto your computer?

In a normal install of SQL Express Advanced, clicking the Remove buttion from ARP will open a dialog titled "Microsoft SQL Server 2005 Uninstall" with a first page that offers a "Component Selection" and lists what SQL components are installed. If you did a full install of Express Advanced, you should have two things available to you:

In the 'Select an Instance' box, you should see one Database Engine named SQLEXPRESS

I can't uninstall SQLEXPRESS

Hi all,

I have a strange problem here. How to uninstall SQLEXPRESS when it does not appear in the "Add/remove program"?

Another problem is that I can't connect to the local server using SQL Server Enterprise manager. This is the error that i got:

"a connection could not be established to (My Computer name)\SQLEXPRESS.
Reason: [SQL-DMO]you must use SQL Server 2005 management tools to connect to this server.
Please verify SQL Server is running and check your SQL Server registration properties (by right-clicking on the DHH-MC\SQLEXPRESS node) and try again. "

I do not want to use SQL 2005 because of some issues. All I need is SQL 2000 to run properly.

Can anybody help me in this? Thanks.

When you say you cannot find SQL Express under the Add/Remove Programs window... are you looking specifically for SQL Express? I ask because for some strange reason it appears there as Microsoft SQL Server 2005. If you see that feel free to remove it and the other SQL components installed along with it.|||

I think it is SQL Server 2005 because i have installed it before.

I have uninstalled everything related to the SQL Server 2005 and even SQL Server 2000. But it is still there. SQL Server 2005 is still appeared at the start program.

And when i installed SQL Server 2000, I can't connect to the local server. This is the error:

a connection could not be established to (My Computer name)\SQLEXPRESS.
Reason: [SQL-DMO]you must use SQL Server 2005 management tools to connect to this server..
Please verify SQL Server is running and check your SQL Server registration properties (by right-clicking on the DHH-MC\SQLEXPRESS node) and try again. "

Any solution?

|||

SQL Server 2005 creates a single entry in the Add/Remove programs dialog that collects all the instances of SQL Server 2005. This acutally makes sense as it gives you a place to easily identify the different instances of SQL Server, as we support installing many.

To remove SQL Express, or any other Edition of SQL Server for that matter, go to Add/Remove Programs, select Microsoft SQL Server 2005 and click Remove. You will be taken to a dialog that lists the various components of SQL Server that are installed, including the Instance Names they are installed under. Simply select the components you wish to remove and proceed thorugh the wizard.

Hopefully this clarifies things for you.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

|||Hi. I've got the same problem with unistalling SQL Express with Adavanced Services SP1. I saw it in Add/Remove programs and tried removing it/unistalling it. It DID NOT take me to a dialog with instances installed and options to select which to install or unistall etc.. all that came up was a info box that stated that other SQL Express components depended on that one nad that I should unistall those first. Well I jotted down which and when I tried to uninstall those the same warning/info box came up listing dependent components..so I jotted those down and went around in circles as they were ALL dependent on each other...so, I went ahead and unistalled verything that had MS SQL Server Express/2005 on Add/Remove Programs and it still shows up in my Start menu in the Programs submenu? Also, when I ran the program again to see if an unistall option came up it will only install..so I went along with it to see if an unsiatll option would eventually come up...it didn't..I went far enough along to where it showed me that it STILL had installed instances of SQL Server Epxress? what's with that? anyways, I then cancelled the installation ...man, this almost remindes me of years ago when I first started out doing desktop support and all the problems we had with users when we tried to unistall their AOL from their company machines...I expected better from MS ..I'm dissapointed ...what can I do to get rid of MS SQL Server Express 2005 completely...we were using this machine to possibly build a deployment image for our learning lab ...but if the oprogram is this hideous, we may just have to scrap it..|||

How did you get Express Advanced installed onto your computer?

In a normal install of SQL Express Advanced, clicking the Remove buttion from ARP will open a dialog titled "Microsoft SQL Server 2005 Uninstall" with a first page that offers a "Component Selection" and lists what SQL components are installed. If you did a full install of Express Advanced, you should have two things available to you:

In the 'Select an Instance' box, you should see one Database Engine named SQLEXPRESS

Monday, March 19, 2012

I cannot explain the difference in execution plans.

I have a very strange problem with my SQL Server database that I cannot
explain. Suppose I have the following stored procedure:
CREATE PROCEDURE sp_TMS_PRJ_Test
@.TestplanVersionId uniqueidentifier = NULL
AS
SELECT @.TestplanVersionId = 'E340196B-D701-4814-8E75-04ABFD2777A5'
SELECT [TMS_PRJ_TestplanTestcases].[Id],[TMS_PRJ_TestResults].[Id]
FROM [TMS_PRJ_TestplanTestcases]
INNER JOIN [TMS_TCH_SpecificationTestcases] ON
[TMS_PRJ_TestplanTestcases].[SpecificationTestcase_Ref] =
[TMS_TCH_SpecificationTestcases].[Id]
INNER JOIN [TMS_TCH_SpecificationConditionSets] ON
[TMS_PRJ_TestplanTestcases].[ConditionSet_Ref] =
[TMS_TCH_SpecificationConditionSets].[Id]
INNER JOIN [TMS_PRJ_TestplanVersions] ON
[TMS_PRJ_TestplanTestcases].[TestplanVersion_Ref] =
[TMS_PRJ_TestplanVersions].[Id]
INNER JOIN [TMS_PRJ_Testplans] ON
[TMS_PRJ_TestplanVersions].[Testplan_Ref] = [TMS_PRJ_Testplans].[Id]
INNER JOIN [TMS_PRJ_TestResults] ON [TMS_PRJ_TestResults].[Project_Ref]
= [TMS_PRJ_Testplans].[Project_Ref]
INNER JOIN [TMS_SWP_TestcaseParameters] ON
[TMS_PRJ_TestResults].[Parameter_Ref] = [TMS_SWP_TestcaseParameters].[Id]
INNER JOIN [TMS_SWP_SoftwarePackageTestcases] ON
[TMS_SWP_TestcaseParameters].[SoftwarePackageTestcase_Ref] =
[TMS_SWP_SoftwarePackageTestcases].[Id]
INNER JOIN [TMS_SWP_UniformTestcases] ON
[TMS_SWP_UniformTestcases].[SoftwarePackageTestcase_Ref] =
[TMS_SWP_SoftwarePackageTestcases].[Id]
WHERE [TMS_PRJ_TestplanTestcases].[TestplanVersion_Ref] =
@.TestplanVersionId
AND [TMS_SWP_UniformTestcases].[UniformTestcase_Ref] =
[TMS_TCH_SpecificationTestcases].[UniformTestcase_Ref]
AND [TMS_PRJ_Testplans].[Active] <> 0
AND [TMS_PRJ_TestResults].[ConditionSet_Ref] =
[TMS_TCH_SpecificationConditionSets].[ConditionSet_Ref]
When I run this stored procedure then it takes over 4 minutes to complete
and takes almost 62 million read
operations to return 1295 rows. Suppose I rewrite this procedure like this:
CREATE PROCEDURE sp_TMS_PRJ_Test
AS
DECLARE @.TestplanVersionId AS uniqueidentifier
SELECT @.TestplanVersionId = 'E340196B-D701-4814-8E75-04ABFD2777A5'
SELECT [TMS_PRJ_TestplanTestcases].[Id],[TMS_PRJ_TestResults].[Id]
FROM [TMS_PRJ_TestplanTestcases]
INNER JOIN [TMS_TCH_SpecificationTestcases] ON
[TMS_PRJ_TestplanTestcases].[SpecificationTestcase_Ref] =
[TMS_TCH_SpecificationTestcases].[Id]
INNER JOIN [TMS_TCH_SpecificationConditionSets] ON
[TMS_PRJ_TestplanTestcases].[ConditionSet_Ref] =
[TMS_TCH_SpecificationConditionSets].[Id]
INNER JOIN [TMS_PRJ_TestplanVersions] ON
[TMS_PRJ_TestplanTestcases].[TestplanVersion_Ref] =
[TMS_PRJ_TestplanVersions].[Id]
INNER JOIN [TMS_PRJ_Testplans] ON
[TMS_PRJ_TestplanVersions].[Testplan_Ref] = [TMS_PRJ_Testplans].[Id]
INNER JOIN [TMS_PRJ_TestResults] ON [TMS_PRJ_TestResults].[Project_Ref]
= [TMS_PRJ_Testplans].[Project_Ref]
INNER JOIN [TMS_SWP_TestcaseParameters] ON
[TMS_PRJ_TestResults].[Parameter_Ref] = [TMS_SWP_TestcaseParameters].[Id]
INNER JOIN [TMS_SWP_SoftwarePackageTestcases] ON
[TMS_SWP_TestcaseParameters].[SoftwarePackageTestcase_Ref] =
[TMS_SWP_SoftwarePackageTestcases].[Id]
INNER JOIN [TMS_SWP_UniformTestcases] ON
[TMS_SWP_UniformTestcases].[SoftwarePackageTestcase_Ref] =
[TMS_SWP_SoftwarePackageTestcases].[Id]
WHERE [TMS_PRJ_TestplanTestcases].[TestplanVersion_Ref] =
@.TestplanVersionId
AND [TMS_SWP_UniformTestcases].[UniformTestcase_Ref] =
[TMS_TCH_SpecificationTestcases].[UniformTestcase_Ref]
AND [TMS_PRJ_Testplans].[Active] <> 0
AND [TMS_PRJ_TestResults].[ConditionSet_Ref] =
[TMS_TCH_SpecificationConditionSets].[ConditionSet_Ref]
In the second example the entire operation is finished in 1.3 seconds, so
this is much faster and takes only
5500 reads (and of course also returns 1295 rows). The execution plans
differ for both queries. As you can
see from the execution trees below, the fast version uses hash matches and
the slow version uses nested
loops. Can anyone explain the difference between the two queries?
PS: If I remove the '[TMS_PRJ_Testplans].[Active] <> 0' clause from the slow
query then it is fast again.
This is weird, because it only needs to check one record in this table.
Execution Tree (slow)
--
Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_PRJ_TestplanTestcases].[SpecificationTestcase_Ref],
[TMS_SWP_UniformTestcases].[UniformTestcase_Ref]) WITH PREFETCH)
|--Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_SWP_TestcaseParameters]
.[SoftwarePackageTestcase_Ref]))
| |--Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_PRJ_TestResults].[Parameter_Ref]))
| | |--Nested Loops(Inner Join,
WHERE:([TMS_PRJ_Testplans].[Id]=[TMS_PRJ_TestplanVersions].[Testplan_Ref]))
| | | |--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_TestplanVersions].[PK_TMS_PRJ_TestplanVersions]),
SEEK:([TMS_PRJ_TestplanVersions].[Id]=[@.TestplanVersionId]) ORDERED FORWARD)
| | | |-- Filter(WHERE:(Convert([TMS_PRJ_Testplans
].[Active])<>0))
| | | |--Bookmark Lookup(BOOKMARK:([Bmk1008]),
OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_Testplans]))
| | | |--Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_PRJ_TestResults].[Project_Ref]))
| | | |--Hash Match(Inner Join,
HASH:([TMS_TCH_SpecificationConditionSet
s].[ConditionSet_Ref])=([TMS_PRJ_Tes
tResults].[ConditionSet_Ref]),
RESIDUAL:([TMS_PRJ_TestResults]. [ConditionSet_Ref]=[TMS_TCH_Specificatio
nCon
ditionSets].[ConditionSet_Ref]))
| | | | |--Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_PRJ_TestplanTestcases].[ConditionSet_Ref]))
| | | | | |--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_TestplanTestcases].[IX_TMS_PRJ_TestplanTestcases_Tes
tplanVersionSpecificationTestcaseConditi
onSet]),
SEEK:([TMS_PRJ_TestplanTestcases]. [TestplanVersion_Ref]=[@.TestplanVersionI
d]
)
ORDERED FORWARD)
| | | | | |--Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_TCH_SpecificationConditionSets].[IX_TMS_TCH_Specificatio
nConditionSets_ID]),
SEEK:([TMS_TCH_SpecificationConditionSet
s].[Id]=[TMS_PRJ_TestplanTestcases].[Con
ditionSet_Ref]) ORDERED FORWARD)
| | | | |--Clustered Index
Scan(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_TestResults].[PK_TMS_PRJ_TestResults]))
| | | |--Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_Testplans]. [IX_TMS_PRJ_Testplans_MilestoneType_Name
]
),
SEEK:([TMS_PRJ_Testplans].[Project_Ref]=[TMS_PRJ_TestResults].[Project_Ref])
ORDERED FORWARD)
| | |--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_SWP_TestcaseParameters].[PK_TMS_SWP_TestcaseParameters])
,
SEEK:([TMS_SWP_TestcaseParameters].[Id]=[TMS_PRJ_TestResults].[Parameter_Ref]) O
RDERED FORWARD)
| |--Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_SWP_UniformTestcases].[IX_TMS_SWP_UniformTestcases_Softw
arePackageTestcaseUniformTestcase]),
SEEK:([TMS_SWP_UniformTestcases]. [SoftwarePackageTestcase_Ref]=[TMS_SWP_T
est
caseParameters].[SoftwarePackageTestcase_Ref]) ORDERED FORWARD)
|--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_TCH_SpecificationTestcases].[PK_TMS_TCH_SpecificationTes
tcases]),
SEEK:([TMS_TCH_SpecificationTestcases].[Id]=[TMS_PRJ_TestplanTestcases].[Specifi
cationTestcase_Ref]),
WHERE:([TMS_SWP_UniformTestcases]. [UniformTestcase_Ref]=[TMS_TCH_Specifica
ti
onTestcases].[UniformTestcase_Ref]) ORDERED FORWARD)
Execution Tree (fast)
--
Hash Match(Inner Join, HASH:([TMS_TCH_SpecificationConditionSet
s].[Id],
[TMS_TCH_SpecificationTestcases].[Id])=([TMS_PRJ_TestplanTestcases].[ConditionSe
t_Ref],
[TMS_PRJ_TestplanTestcases].[SpecificationTestcase_Ref]),
RESIDUAL:([TMS_TCH_SpecificationConditio
nSets].[Id]=[TMS_PRJ_TestplanTestcases].
[ConditionSet_Ref]
AND
[TMS_TCH_SpecificationTestcases].[Id]=[TMS_PRJ_TestplanTestcases].[Specification
Testcase_Ref]))
|--Hash Match(Inner Join,
HASH:([TMS_SWP_UniformTestcases]. [UniformTestcase_Ref])=([TMS_TCH_Specifi
cat
ionTestcases].[UniformTestcase_Ref]),
RESIDUAL:([TMS_SWP_UniformTestcases].[UniformTestcase_Ref]=[TMS_TCH_Specific
ationTestcases].[UniformTestcase_Ref]))
| |--Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_SWP_TestcaseParameters]
.[SoftwarePackageTestcase_Ref]))
| | |--Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_PRJ_TestResults].[Parameter_Ref]))
| | | |--Hash Match(Inner Join,
HASH:([TMS_TCH_SpecificationConditionSet
s].[ConditionSet_Ref])=([TMS_PRJ_Tes
tResults].[ConditionSet_Ref]),
RESIDUAL:([TMS_PRJ_TestResults]. [ConditionSet_Ref]=[TMS_TCH_Specificatio
nCon
ditionSets].[ConditionSet_Ref]))
| | | | |--Index
Scan(OBJECT:([SiemensTMS].[dbo].[TMS_TCH_SpecificationConditionSets].[IX_TMS_TCH_Specificatio
nConditionSets_ID]))
| | | | |--Nested Loops(Inner Join,
WHERE:([TMS_PRJ_TestResults].[Project_Ref]=[TMS_PRJ_Testplans].[Project_Ref]
))
| | | | |--Nested Loops(Inner Join, OUTER
REFERENCES:([TMS_PRJ_TestplanVersions].[Testplan_Ref]))
| | | | | |--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_TestplanVersions].[PK_TMS_PRJ_TestplanVersions]),
SEEK:([TMS_PRJ_TestplanVersions].[Id]=[@.TestplanVersionId]) ORDERED FORWARD)
| | | | | |--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_Testplans].[PK_TMS_PRJ_Testplans]),
SEEK:([TMS_PRJ_Testplans].[Id]=[TMS_PRJ_TestplanVersions].[Testplan_Ref]),
WHERE:(Convert([TMS_PRJ_Testplans].[Active])<>0) ORDERED FORWARD)
| | | | |--Clustered Index
Scan(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_TestResults].[PK_TMS_PRJ_TestResults]))
| | | |--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_SWP_TestcaseParameters].[PK_TMS_SWP_TestcaseParameters])
,
SEEK:([TMS_SWP_TestcaseParameters].[Id]=[TMS_PRJ_TestResults].[Parameter_Ref]) O
RDERED FORWARD)
| | |--Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_SWP_UniformTestcases].[IX_TMS_SWP_UniformTestcases_Softw
arePackageTestcaseUniformTestcase]),
SEEK:([TMS_SWP_UniformTestcases]. [SoftwarePackageTestcase_Ref]=[TMS_SWP_T
est
caseParameters].[SoftwarePackageTestcase_Ref]) ORDERED FORWARD)
| |--Index
Scan(OBJECT:([SiemensTMS].[dbo].[TMS_TCH_SpecificationTestcases].[IX_TMS_TCH_SpecificationTes
tcases_SpecificationVersionUniformTestca
se]))
|--Clustered Index
S(OBJECT:([SiemensTMS].[dbo].[TMS_PRJ_TestplanTestcases].[IX_TMS_PRJ_TestplanTestcases_Tes
tplanVersionSpecificationTestcaseConditi
onSet]),
SEEK:([TMS_PRJ_TestplanTestcases]. [TestplanVersion_Ref]=[@.TestplanVersionI
d]
)
ORDERED FORWARD)Google for "parameter sniffing".
Also consider using indexed views when low-selectivity status columns exist
in the tables. If [TMS_PRJ_Testplans].[Active] is such a column, then rather
than indexing the column, consider using an indexed view for each status
value.
Although in your case a simple "[TMS_PRJ_Testplans].[Active] = 1" (if value
1 is appropriate) might help.
ML
http://milambda.blogspot.com/|||Ramon de Klein (RamondeKlein@.discussions.microsoft.com) writes:
> I have a very strange problem with my SQL Server database that I cannot
> explain. Suppose I have the following stored procedure:
> CREATE PROCEDURE sp_TMS_PRJ_Test
> @.TestplanVersionId uniqueidentifier = NULL
> AS
> SELECT @.TestplanVersionId = 'E340196B-D701-4814-8E75-04ABFD2777A5'
>...
> CREATE PROCEDURE sp_TMS_PRJ_Test
> AS
> DECLARE @.TestplanVersionId AS uniqueidentifier
> SELECT @.TestplanVersionId = 'E340196B-D701-4814-8E75-04ABFD2777A5'
>...
> In the second example the entire operation is finished in 1.3 seconds, so
> this is much faster and takes only
> 5500 reads (and of course also returns 1295 rows). The execution plans
> differ for both queries. As you can
> see from the execution trees below, the fast version uses hash matches and
> the slow version uses nested
> loops. Can anyone explain the difference between the two queries?
This is something that baffles about anyone at some point in his SQL
Server career, but once you know how SQL Server builds query plans, it is
less mysterious.
Say that would hard-code the GUID into the query. In this case, SQL
Server knows exactly what you are after, and can look at the statistics
to be able to make an estimate of how many rows it will hit.
On the other hand, when you use a variable, SQL Server does not know
which value the variable will have at run-time, so it makes a standard
assumption.
For procedure parameters there is yet a choice. When you call the
procedure the first time, SQL Server uses the actual parameter value
and builds the plan according to that. Tbis means that if the first
call is for an atypical value, or, as in this, you assign a default
value, you're taking SQL Server to the cleaners.
For procedures where you need to have a parameter with a NULL default
value which in reality means something else, for instance "today" for
a date parameter, you should always copy the parameter into a local
variable, so that the optimizer does not act on incorrect information.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||When I rewrite the stored procedure, so it doesn't the parameter at all then
it is still slow. In this case I hardcoded the GUID
'E340196B-D701-4814-8E75-04ABFD2777A5' into the query, but it is still slow.
When I use an intermediate variable to push the GUID into the SELECT query
then it is fast again, so this query is fast (1 second)
SELECT @.Parameter = 'E340196B-D701-4814-8E75-04ABFD2777A5'
SELECT X,Y
FROM ...
INNER JOIN ...
WHERE Clause = @.Parameter
And this one is slow (over 4 minutes):
SELECT X,Y
FROM ...
INNER JOIN ...
WHERE Clause = 'E340196B-D701-4814-8E75-04ABFD2777A5
It doesn't have anything to do with stored procedures, because when I run it
manually in SQL Query Analyser then the results are the same. I think I have
hit a bug in SQL Server 2000.
--
Greetings,
Ramon de Klein|||Ramon de Klein (RamondeKlein@.discussions.microsoft.com) writes:
> When I rewrite the stored procedure, so it doesn't the parameter at all
> then it is still slow. In this case I hardcoded the GUID
> 'E340196B-D701-4814-8E75-04ABFD2777A5' into the query, but it is still
> slow. When I use an intermediate variable to push the GUID into the
> SELECT query then it is fast again, so this query is fast (1 second)
> SELECT @.Parameter = 'E340196B-D701-4814-8E75-04ABFD2777A5'
> SELECT X,Y
> FROM ...
> INNER JOIN ...
> WHERE Clause = @.Parameter
> And this one is slow (over 4 minutes):
> SELECT X,Y
> FROM ...
> INNER JOIN ...
> WHERE Clause = 'E340196B-D701-4814-8E75-04ABFD2777A5
> It doesn't have anything to do with stored procedures, because when I
> run it manually in SQL Query Analyser then the results are the same. I
> think I have hit a bug in SQL Server 2000.
Maybe. Or maybe not.
The likely problem here is that the statistics indicate that the
query will hit more rows for this GUID that it actually does. First
try UPDATE STATISTICS WITH FULLSCAN for this table. If you still get
the same result, post the output from DBCC SHOW_STATISTICS for this
index.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Wednesday, March 7, 2012

Hypothetical indexes

hi,
i found strange indexes on table..
index name : hind010,02,03,04 05...(something like this)
type : clustered hypothetical indexes...
can anyone help me wot all these are..
my table originally has only 3 indexes..and this table is linked with relation ship integrity with other 15 tables..
how come this indexes are created..there are total 15..hypothetical indexes...
any help would be appreciated..They were most probably created by the Index Tuning Wizard. I don't remember whether you delete
these using DROP INDEX or DROP STATISTICS but one of these should work.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"sanjay" <anonymous@.discussions.microsoft.com> wrote in message
news:F8EE1587-3A79-4E3A-85B8-BE0B5B2E3A59@.microsoft.com...
> hi,
> i found strange indexes on table..
> index name : hind010,02,03,04 05...(something like this)
> type : clustered hypothetical indexes...
> can anyone help me wot all these are..
> my table originally has only 3 indexes..and this table is linked with relation ship integrity with
other 15 tables..
> how come this indexes are created..there are total 15..hypothetical indexes...
> any help would be appreciated..|||Check out
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q293/1/77.ASP&NoWebContent=1
for more details.
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"sanjay" <anonymous@.discussions.microsoft.com> wrote in message
news:F8EE1587-3A79-4E3A-85B8-BE0B5B2E3A59@.microsoft.com...
> hi,
> i found strange indexes on table..
> index name : hind010,02,03,04 05...(something like this)
> type : clustered hypothetical indexes...
> can anyone help me wot all these are..
> my table originally has only 3 indexes..and this table is linked with
relation ship integrity with other 15 tables..
> how come this indexes are created..there are total 15..hypothetical
indexes...
> any help would be appreciated..