These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: <many-to-one> with nonclustered index
PostPosted: Fri Mar 05, 2010 2:53 am 
Newbie

Joined: Fri Mar 05, 2010 12:00 am
Posts: 2
Hi All,

I have one table with 200 milion records migrated. I have created nonclustered index(IX_ENTMCFDtl_ProcessLogID) on ProcessLogID. I am using NHibernate Criteria to retrive the record by processlogid.
E.g 1: select top 15 from ENTMCFDtl where processlogid = 1038
There are total 2200 records base on processlogid = 1038 but I only need to retrive 15 per paging.
above statement return took very long time(nearly 2 mins).

E.g 2 : select top 15 * from ENTMCFDtl with (index=3) where processlogid = 1038
this statement responsed very fast (withing a second).

I don't know how to add with (index=3) in NHibernate.
My question is that where should i force to use IX_ENTMCFDtl_ProcessLogID index. Here is my HBM relation table structure. Please HELP.

<many-to-one name="ProcessLog" index="IX_ENTMCFDtl_ProcessLogID " column="ProcessLogID" class="ProcessLog">
<meta attribute="read-only">false</meta>
<meta attribute="nullable">true</meta>
<meta attribute="value-type">false</meta>
</many-to-one>


CREATE TABLE [dbo].[ENTMCFDtl](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[ProcessLogID] [bigint] NULL,
[LMerchantCode] [varchar](15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[AcquirerCode] [varchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CurrencyFXGroupCode] [varchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[TimeZoneCode] [varchar](5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

CONSTRAINT [PK_EntMCFDtl] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[ENTMCFDtl] WITH CHECK ADD CONSTRAINT [FK_EntMCFDtl_ProcessLog] FOREIGN KEY([ProcessLogID])
REFERENCES [dbo].[ProcessLog] ([ID])
GO


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.