This is my query, I plan to run it in batches of perhaps 5000 hence the rownum < 5000
delete my_table
where rownum < 5000
and type = 'Happy'
and id not in
( select max_id
from ( select max(log_id) max_id
, object_id
, type
from my_table
where type = 'Happy'
group
by id
, type
)
)
I want to delete happy records but keeping the maximum log id, per object id
I hope that makes sense.
Should I be using some sort of join to improve performance?