Bob Schneider
asked on
Optimizing a Query
Here is a SQL Server 2012 query. Is there a way that it could be re-structured to perform better?
SELECT pr.Bib, p.LastName, p.FirstName, p.Gender, pr.Age, ir.ChipTime, ir.FnlTime, ir.ChipStart, p.City, p.St
FROM Participant p JOIN IndResults ir ON p.ParticipantID = ir.ParticipantID
JOIN PartRace pr ON pr.RaceID = ir.RaceID AND pr.ParticipantID = p.ParticipantID
WHERE ir.RaceID = " & lRaceID & " AND ir.FnlTime IS NOT NULL AND ir.FnlTime > '00:00:00.000' AND p.Gender = '" & sGender & "' ORDER BY " & sOrderBy
SELECT pr.Bib, p.LastName, p.FirstName, p.Gender, pr.Age, ir.ChipTime, ir.FnlTime, ir.ChipStart, p.City, p.St
FROM Participant p JOIN IndResults ir ON p.ParticipantID = ir.ParticipantID
JOIN PartRace pr ON pr.RaceID = ir.RaceID AND pr.ParticipantID = p.ParticipantID
WHERE ir.RaceID = " & lRaceID & " AND ir.FnlTime IS NOT NULL AND ir.FnlTime > '00:00:00.000' AND p.Gender = '" & sGender & "' ORDER BY " & sOrderBy
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How could I make the sort on the client side?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
VItor, yeah I am using a simple html table to display the data. Ultimately I should incorporate jquery but for now...
Thanks for all of the help. And, yes I do have clustered indexes on those table fields so it is probably as good as it can get... We will be timing roughly 3000 runners on July 4th and they will all be looking for their results via results emails that we send upon finishing so I am just trying to avoid a web crash. We use SQL Server 2012 Web on our server.
Thanks for all of the help. And, yes I do have clustered indexes on those table fields so it is probably as good as it can get... We will be timing roughly 3000 runners on July 4th and they will all be looking for their results via results emails that we send upon finishing so I am just trying to avoid a web crash. We use SQL Server 2012 Web on our server.
ASKER