Hi,
Ive been working all day on optimizing a SQL Server 2000 db table with ~9million rows. My only db experience has been with tables with a few hundred rows, so I've never really had to deal with optimization.
I am doing selects and updates based on a 21 digit number.
Using an indexed char(21) type, the queries take more then 2 seconds and the SQL Server process takes 1.5gigs of ram and 100% cpu.
With a indexed bigint type my queries take a few milliseconds and the process takes ~100MB of ram.
I just want to understand what is happening here, is this normal, or is there a specific way a char type can be indexed for better performance?
Heres some of my sql:
CREATE TABLE data
(
tableID int NOT NULL IDENTITY PRIMARY KEY,
tag char(21) NOT NULL UNIQUE,
dataColumn1 datetime NULL,
dataColumn2 char(8) NULL,
lastModified datetime NOT NULL
)
Parameterized query from c#:
SELECT tag FROM data WHERE tag = @tag;
Thanks for any help.