Skip to content

Instantly share code, notes, and snippets.

@velll
Created October 3, 2014 07:55
Show Gist options
  • Select an option

  • Save velll/66e6ea297ee5a4748d85 to your computer and use it in GitHub Desktop.

Select an option

Save velll/66e6ea297ee5a4748d85 to your computer and use it in GitHub Desktop.
Delete and index 1M rows
CREATE TABLE test_index_delete(
num NUMBER)
INSERT INTO test_index_delete
SELECT 1000238674 + LEVEL
FROM DUAL
CONNECT BY LEVEL <= 1000000
commit
select * from test_index_delete order by num asc
begin
for i in 1..100
loop
delete from test_index_delete where num < 1000238711 + i*10;
end loop;
end;
2.636
rollback
create index test_index_delete_idx on test_index_delete(
num asc)
tablespace hydra_index
0.04
begin
for i in 1..100
loop
delete from test_index_delete where num < 1000238711 + i*10;
end loop;
end;
rollback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment