In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
CREATE INDEX windowsevent_idx_devicei_severit_eventlo_timeofe ON WindowsEvent (DeviceID,Severity,EventLog,TimeOfEvent);
CREATE INDEX windowsevent_idx_devic_sever_event_event_event_descr ON WindowsEvent (DeviceID,Severity,EventLog,EventID,EventSource,Description);
SELECT
COUNT(*) AS NumOcc,
WindowsEvent.EventID,
WindowsEvent.EventLog,
WindowsEvent.EventSource,
WindowsEvent.Severity,
WindowsEvent.TimeOfEvent,
WindowsEvent.Description
FROM
WindowsEvent
WHERE
WindowsEvent.DeviceID = '34818'
AND WindowsEvent.Severity = 1
AND WindowsEvent.TimeOfEvent >= DATEADD(hh, DATEDIFF(hh, GETDATE(), GETUTCDATE()), '2010/10/27 12:00:00 AM')
AND WindowsEvent.TimeOfEvent <= DATEADD(hh, DATEDIFF(hh, GETDATE(), GETUTCDATE()), '2010/11/3 12:00:00 AM')
AND WindowsEvent.EventID <> 34113
AND WindowsEvent.EventID <> 34114
AND WindowsEvent.EventID <> 34112
AND WindowsEvent.EventID <> 57755
AND WindowsEvent.EventSource <> 'AutoImportSvc.exe'
AND WindowsEvent.EventLog = 'Application'
GROUP BY
WindowsEvent.EventID,
WindowsEvent.EventLog,
WindowsEvent.EventSource,
WindowsEvent.Severity,
WindowsEvent.Description
ORDER BY
NumOcc DESC