I want to keep the last 20 records in VMR
table and delete all other records. The VMR table has 5000000
records and its growing. I also have create_date column which has date datatype
in VMR
table and it has non unique index. I tried using rownum to delete the records and keep the last 20 records using below query but its taking too much time for deletion. Is there any other way to run the query faster.
delete from VMR
where rowid not in
(select rowid
from VMR
where rownum <=20);