I have to run a query where I need to find all records that were created OR updated within a date range.
The problem with this is that the data set is large and so a query in the past couple years can return a few million rows.
I think there are a couple problems here.
MySQL isn't going to be able to choose a key/index since it's doing created_at > X OR updated_at > X, so it's going to be slow. How can I speed this up?
WHERE updated_at > X
? Surely a row cannot be updated before it is created, can it? – ypercubeᵀᴹ Nov 9 '17 at 0:06