SQL Server 2005 Tuning Advisor

Posts   
 
    
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 06-Dec-2005 19:58:40   

Has anyone tried the SQL Server 2005 Tuning Advisor with Profiler output from LLBLGen?

It's reporting that all the SQL contains Syntax Errors for me... I've tried it on several machines and was wondering if anyone can confirm this?

Marcus

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 08-Dec-2005 12:24:24   

Could you elaborate what kind of syntax errors? Because the SQL isnt different from sqlserver 2000's....

Frans Bouma | Lead developer LLBLGen Pro
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 09-Dec-2005 13:20:01   

Otis wrote:

Could you elaborate what kind of syntax errors? Because the SQL isnt different from sqlserver 2000's....

I was just asking if anyone has successfully managed to run the tuning advisor in 2005 agaisnt an output from LLBLGen... It's probably a problem with SQL Server 2005 rather than LLBLGen.

Here's what happens:

Basically if I run a trace using the profiler (which I've done successfully many times with SQL Server 2000simple_smile ) and save it to a file, I should be able to run the Tuning Wizard (now called the tuning advisor) against this file and it will highlight missing indexes etc.

With SQL Server 2005, the Database Tuning Advisor reports during the "Consuming Workload" phase of the Analysis: "85% of the consumed workload has syntax errors"

Here is a selection of the errors from the log which include some security and other issues:

S001    declare @FolderID bigint,@ItemID bigint,@IsActive bit
select @FolderID=107,@ItemID=1455,@IsActive=1
INSERT INTO [ModernArk].[dbo].[Ark_FolderItemLink] ([FolderID], [ItemID], [IsActive]) VALUES (@FolderID, @ItemID, @IsActive)    declare @FolderID bigint,@ItemID bigint,@IsActive bit
select @FolderID=107,@ItemID=1455,@IsActive=1   1   Statement does not reference any tables

S008    exec sp_executesql N'INSERT INTO [ModernArk].[dbo].[Ark_FolderItemLink] ([FolderID], [ItemID], [IsActive]) VALUES (@FolderID, @ItemID, @IsActive)',N'@FolderID bigint,@ItemID bigint,@IsActive bit',@FolderID=107,@ItemID=1460,@IsActive=1      1   Event does not reference any tables

S008    BEGIN TRANSACTION 54    Event does not reference any tables

E000    IF @@rowcount = 0 54    [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '0'. 

Basically it seems ALL the "exec sp_executesql N'...'" is ignored because it thinks they dont reference any tables... disappointed

I just wanted to confirm if this is just me or does everyone have this same problem?

Marcus

DavideB
User
Posts: 48
Joined: 22-May-2006
# Posted on: 29-Mar-2007 14:34:03   

I'm currently looking to solve the same problem, it seems like the SQL Server 2005 Database Engine Tuning Advisor is not able to correctly analyze the trace generated by the execution of LLBL queries. Has anyone been successfully using DTA on queries executed by LLBL code?

Thanks, Davide

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 29-Mar-2007 18:34:30   

Have you installed SQL Server 2005 SP2? Which version of SQL server are you using?

select @@version
DavideB
User
Posts: 48
Joined: 22-May-2006
# Posted on: 29-Mar-2007 18:36:29   

I already applied SP2 on SQL Server 2005. Here's the version.

Microsoft SQL Server 2005 - 9.00.3050.00 (X64)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 29-Mar-2007 19:21:41   

What does " it seems like the SQL Server 2005 Database Engine Tuning Advisor is not able to correctly analyze the trace generated by the execution of LLBL queries." really mean? What's 'not correctly' exactly? As the queries are simply T-SQL queries, nothing fancy.

Frans Bouma | Lead developer LLBLGen Pro
DvK
User
Posts: 318
Joined: 22-Mar-2006
# Posted on: 29-Mar-2007 21:33:15   

Hi,

I had the same "error messages" when the Tuning advisor processed the trace output of the Profiler, but it seems to me that they're just warnings, nothing really serious, because the advisor finished normally....but I could not analyze the impact/problem for 100%.

Try it for yourself....then you'll see the warnings !

Kind regards, Danny

DavideB
User
Posts: 48
Joined: 22-May-2006
# Posted on: 29-Mar-2007 21:39:49   

Otis wrote:

What does " it seems like the SQL Server 2005 Database Engine Tuning Advisor is not able to correctly analyze the trace generated by the execution of LLBL queries." really mean? What's 'not correctly' exactly? As the queries are simply T-SQL queries, nothing fancy.

I'm experiencing exactly the same behaviour Marcus described. DTA marks nearly over 80% of the queries traced as "syntax errors".

I'm just asking if anyone else had this problem and how to work around this behaviour of DTA when using LLBL, as I didn't find a response to the problem originally reported by Marcus.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 30-Mar-2007 11:06:34   

DavideB wrote:

Otis wrote:

What does " it seems like the SQL Server 2005 Database Engine Tuning Advisor is not able to correctly analyze the trace generated by the execution of LLBL queries." really mean? What's 'not correctly' exactly? As the queries are simply T-SQL queries, nothing fancy.

I'm experiencing exactly the same behaviour Marcus described. DTA marks nearly over 80% of the queries traced as "syntax errors".

I'm just asking if anyone else had this problem and how to work around this behaviour of DTA when using LLBL, as I didn't find a response to the problem originally reported by Marcus.

Ok, no problem, I wasn't questioning your question, I was more interested in what kind of errors you got wink .

What I find a little funny is that the queries are syntax errors though. All our queries are IMHO formulated correctly and use full names for fields/tables etc. But perhaps the analyser of them isn't that smart, I have no idea. The exec sp_executesql calls are from ADO.NET's SqlClient. The SqlClient sends all queries as exec sp_executeSql ... to the database. This is done to re-use execution plans more easier.

It might be the exec sp_executesql is confusing the analyser.

Frans Bouma | Lead developer LLBLGen Pro