I have the following table:
CREATE TABLE [dbo].[Addr](
[Address] [char](34) NOT NULL,
CONSTRAINT [PK_Addr] PRIMARY KEY CLUSTERED
(
[Address] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
And I'm trying to execute a query:
SELECT COUNT(*)
FROM Addr
When a table contains about 8 million records, it runs immediately. But now the table contains 21 million records, and the query is very slow. Managemet Studio shows the following calculation plan:

Screenshot from the Storage tab (Table Properties):

I use MSSQL 2008 Express 10.50.1617.0. Why does this simple query have such a complicated plan?
source
share