I'm attempting to query from a table to get some specific date with the following query:
SELECT
[bmUnitId] AS BMUnitID,
[DataType],
[LocalTimeFrom],
[LocalTimeTo],
[LevelTo]
FROM
tibcoRampPosition
WHERE
LocalTimeTo between '".$chosenDate1."' and '".$chosenDate2."'
AND
bmUnitId = '".$chosenBMUnit."'
AND
DataType = 8
ORDER BY
LocalTimeTo asc
I've checked the variables over, making sure they are what I intend (by echoing them before they query is performed). The problem is, the table it is querying data from has 56,685,678 rows, being a 5.3 GB database.
It takes >5 minutes to perform the query. I was wondering if there's anyway I can improve this as... I'd like it to be 10 seconds execution times max pretty much. 5 minutes isn't great for application use.