I am trying to use the data explorer to try and evaluate the prevalence of a phenomenon on (main) Stack Overflow where either the accepted or the top-voted answer is actually intrinsically flawed. Unfortunately, the query either times out with the message "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.", or it returns no result after a time suspiciously close to the timeout delay (120 seconds), where I know for a fact there is at least one result.
No matter, I'm going to limit the answers to a range, and make multiple queries… Nope, doesn't work either, even if I limit to 1 Id or one day, the query still times out. I tried simplifying the query. I tried limiting to the top ten. I tried querying in the middle of the (north American) night. I tweaked everything I could. I sacrificed files to the gods of databases. To no avail.
So, what the heck is wrong with either my query, SEDE, or possibly me?
(last parameters I tried with are 05/05/2009 to 06/06/2009, because I have no idea which date format SEDE actually accepts. Query is on the SO proper db.)
declare @startDate datetime = ##startDate##;
declare @endDate datetime = ##endDate##;
select top 10
a.Id as [Post Link],
c.text as [Reason]
from
Posts q
inner join
Posts a
on (a.ParentId = q.Id)
inner join
Comments c
on (c.PostId = a.Id)
where
(a.CreationDate <= @endDate)
and (a.CreationDate >= @startDate)
and
((a.Id = q.AcceptedAnswerId)
or (a.Score = (
SELECT TOP 1 Score
FROM Posts otherA
WHERE
otherA.ParentId = q.Id
ORDER BY Score DESC))
)
and ((Upper(c.text) LIKE Upper('%race%'))
or (Upper(c.text) LIKE Upper('%security%'))
or (Upper(c.text) LIKE Upper('%vulnerability%')))
;