Sql Server query performance
Posted
by Macros
on Stack Overflow
See other posts from Stack Overflow
or by Macros
Published on 2010-05-07T11:18:14Z
Indexed on
2010/05/07
11:38 UTC
Read the original article
Hit count: 146
tsql
|sql-server
I have a stored procedure on a busy database which constantly come out top in the list of expensive queries (by some way). The query is very simple, it takes a single parameter (@ID, int) which is the primary key of the table, and selects the record that matches that ID. The primary key is an identity field with a clustered index, so I am stumped as to how to optimise this any further?
The query is as follows
CREATE PROCEDURE [dbo].[P_Call_Get]
@ID int = null
AS
select ID,
AppID,
AgentID,
AgentLogin,
Ext,
VDN,
VDNName,
Skill,
SkillName,
CallFrom,
TelNoFrom,
ParentCallID,
CallStart,
ACWStart,
CallEnd,
Outcome,
StageID,
TxTo,
TxSuccess,
ServiceID,
DiallerID,
CRC,
TSCallID,
CallDirection,
[Manual],
CallBackAgent,
CallBackDateTime,
Notes
from P_Call
where (ID = @ID or @ID is null)
Not sure the best way to post the execution plan - all it shows is that 100% of the operation is taken up by the clustered index scan
© Stack Overflow or respective owner