我有表的很多记录。当我执行以下查询时,需要很长时间。我怎样才能提高性能?如何提高查询性能
SET ROWCOUNT 10
SELECT StxnID
,Sprovider.description as SProvider
,txnID
,Request
,Raw
,Status
,txnBal
,Stxn.CreatedBy
,Stxn.CreatedOn
,Stxn.ModifiedBy
,Stxn.ModifiedOn
,Stxn.isDeleted
FROM Stxn,Sprovider
WHERE Stxn.SproviderID = SProvider.Sproviderid
AND Stxn.SProviderid = ISNULL(@pSProviderID,Stxn.SProviderid)
AND Stxn.status = ISNULL(@pStatus,Stxn.status)
AND Stxn.CreatedOn BETWEEN ISNULL(@pStartDate,getdate()-1) and ISNULL(@pEndDate,getdate())
AND Stxn.CreatedBy = ISNULL(@pSellerId,Stxn.CreatedBy)
ORDER BY StxnID DESC
stxn表有超过100,000条记录。
查询是从asp.net C#中的报表查看器中运行。
它会很难不知道你是如何表,索引等。请考虑向我们展示执行计划。 –
什么版本的SQL Server? –
我做存储过程。我使用数据集来检索存储过程。 –