MaxNumberOfItems not causing a server side TOP to be executed.

Posts   
 
    
MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 21-Nov-2008 11:32:56   

I have the following code:

EventLogCollection errors = new EventLogCollection(); errors.GetMulti(null,10); //new SortExpression(new SortClause(EventLogFields.Occurred,SortOperator.Descending))

which is timing out live.

On inspection with SQL Profiler, I can see that no TOP statement is emitted by LLBLGEN

I have read a couple of threads about this being the case for certain cases with a relationcollection) but this is a bog standard GetMulti!

(I have tried with and without the SortExpression)

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 21-Nov-2008 12:00:53   

Please post more information about the database version, LLBLGen runtime library version (build), the EventLog table DDL.

MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 21-Nov-2008 12:36:27   

Thanks - details as below:

DB: SQL Server 2005 LLBLGen: 2.6

Relevant table:

CREATE TABLE [dbo].[EventLog](
    [EventId] [int] IDENTITY(1,1) NOT NULL,
    [Occurred] [smalldatetime] NOT NULL,
    [Severity] [smallint] NOT NULL,
    [LineOfCode] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_EventLog_InternalLineOfCode]  DEFAULT (''),
    [Unhandled] [bit] NOT NULL,
    [Subject] [varchar](128) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_EventLog_Subject]  DEFAULT (''),
    [URLNoQuerystring] [varchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL CONSTRAINT [DF_EventLog_URL]  DEFAULT (''),
    [SessionId] [int] NULL,
    [EventCodeId] [int] NOT NULL CONSTRAINT [DF_EventLog_EventCodeId]  DEFAULT ((0)),
    [EventDetail] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [EventQuerystring] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
 CONSTRAINT [PK_EventLog] PRIMARY KEY CLUSTERED 
(
    [EventId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 21-Nov-2008 16:06:21   

Be sure you're using the latest runtimes (also the latest SqlServer DQE) for v2.6, as we made a change to the check routine for duplicates and although your table contains a blob field, 'distinct' isn't necessary so it should emit top.

Frans Bouma | Lead developer LLBLGen Pro
MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 24-Nov-2008 09:55:06   

Okay here's what I have locally:

SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll - 2.6.8.612 SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll - 2.6.8.616 SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll - 2.6.8.624 SD.LLBLGen.Pro.TypeConverters.dll - 2.5.0.0

TIA

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 24-Nov-2008 10:27:03   

SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll - 2.6.8.624

That's from last June, please download and use the latest version.

MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 24-Nov-2008 11:31:19   

Will do..

I'm wondering why I have this one. It's the same one included in:

C:\Program Files\Solutions Design\LLBLGen Pro v2.6\RuntimeLibraries\DotNET20

There's no equivalent binary in the DotNet35 folder, which is why I used the DotNet20 version..

MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 24-Nov-2008 12:22:22   

No change . No TOP keyword is emitted.

I'm going to try and repro the issue in an isolated project.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 24-Nov-2008 12:29:39   

Not needed, I think this is the same issue: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=14043

Please read my explanation there. I.o.w.: it's not fetching ALL rows, though it's also not able to produce the most optimal query. (it limits on the client, so it will fetch only the rows needed, not all rows are sent to the client, just the # of rows you requested).

Frans Bouma | Lead developer LLBLGen Pro
MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 24-Nov-2008 12:44:44   

Its timing out on live data though...

I can exclude the blob field, so going to do that instead..

thanks,