I have the following sql statement, which I need to do faster. There are 500k rows, and I have an index for HARDWARE_ID, but it still takes up to a second to execute.
Does anyone have any ideas?
select
*
from
DEVICE_MONITOR DM
where
DM.DM_ID = (
select
max(DM_ID)
from
DEVICE_MONITOR
where
HARDWARE_ID=#value#
)
I found the following index, also great help ...
CREATE INDEX DM_IX4 ON DEVICE_MONITOR (DM_ID, HARDWARE_ID);
In my test, it disables runtime from 26 seconds to 20 seconds.
Thank you for your help.
source
share