I have a lot of records in table. When I execute the following query it takes a lot of time. How can I improve the performance?
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
The stxn table has more than 100,000 records.
The query is run from a report viewer in asp.net c#.