Is there a way to improve my query
SELECT *
FROM StringControllerDaten
WHERE StringControllerDaten.Erstellt NOT IN
(
SELECT
Min(Erstellt) AS Erstellt
FROM StringControllerDaten
GROUP BY
StringControllerDaten.StringController,
DATEPART(YEAR, Erstellt),
DATEPART(MONTH, Erstellt),
DATEPART(DAY, Erstellt),
DATEPART(HOUR, Erstellt),
(DATEPART(MINUTE, Erstellt) / 15)
)
This query returns all data who doesn't match one of the min Datetimes from the 15Min Interval.
It is running again +1Mio Row's and takes hours.
Edit:
the estimated query plan