I am currently considering a performance issue with the widely used .NET CMS system and have a specific table with approximately 5,000,000 entries in it, which is the main cause of these problems, it just takes 2 minutes to query the contents of this table in my local development environment.
Looking at the table schema, I noticed that there is only one unique non-clustered index and a clustered index.
The table and index are defined as follows
CREATE TABLE [dbo].[MyTable]( [Id] [uniqueidentifier] NOT NULL, [ItemId] [uniqueidentifier] NOT NULL, [Language] [nvarchar](50) NOT NULL, [FieldId] [uniqueidentifier] NOT NULL, [Value] [nvarchar](max) NOT NULL, [Created] [datetime] NOT NULL, [Updated] [datetime] NOT NULL ) CREATE UNIQUE NONCLUSTERED INDEX [IX_Unique] ON [dbo].[MyTable] ( [ItemId] ASC, [Language] ASC, [FieldId] ASC )
Does anyone have any suggestions for indexes in this table to improve query performance and, in particular, is it always good to define a clustered index in a table?
thanks
nickc source share