I have one table now
CREATE TABLE [dbo].[EmailData](
[ID] [int] IDENTITY(1,1) NOT NULL,
[Email] [nvarchar](255) NOT NULL,
[Domain] [nvarchar](255) NOT NULL,
[Status] [real] NOT NULL,
[Dated] [datetime] NULL,
CONSTRAINT [PK_EmailData] PRIMARY KEY CLUSTERED
(
[Email] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Now the problem is this suppose i have 100 million records in my table emaildata with status 0,1,2,3,4
and i fire sql select query
like
select Status,COUNT(status) as counttotal from EmailData group by Status
i am getting time out even if i breaks the records into 100,000 records
select Status,COUNT(status) as counttotal from EmailData where id between 0 and 100000 group by Status
i am getting time out most of the time, even firing the same command from sql server management studio as we are using sqlserver 2008 enterprises.
so please help me
connection string i am using in this is
Provider=SQLOLEDB;Data Source=LOCALHOST\SQL2008;Initial Catalog=dbEmailData;Integrated Security=SSPI;Connect Timeout=600;