Saturday 15 August 2015

sql server 2008 r2 - SQL General Optimization -



sql server 2008 r2 - SQL General Optimization -

recently asked help query optimization

the table looks this:

create table dbo.table ( id int identity primary key clustered , column_1 varchar(64) not null , date datetime not null , column_2 varchar (32) not null , column_3 int not null )

and select looks

select * table column_1 = @value1 , date > @value2

i propose show columns names instead of * in select , because can help avoid loading unneeded data, propose create nonclustered index on column_1. however, execution plan still shows same amount of memory used query.

what else should check or add together query?

you can optimize query using indexes. 1 want on column_1 , date:

create index idx_table_column1_date on table(column_1, date);

sql sql-server-2008-r2 sql-optimization

No comments:

Post a Comment