The problem with telling people that some feature of Oracle is a “good thing” is that some of those people will go ahead and use it; and if enough people use it some of them will discover a hitherto undiscovered defect. Almost inevitably the bug will turn out to be one of those “combinations” bugs that leaves you thinking: “Why the {insert preferred expression of disbelief here} should {feature X} have anything to do with {feature Y}”.
Here – based on index compression, as you may have guessed from the title – is one such bug. I got it first on 11.1.0.7, but it’s still there on 11.2.0.4 and 12.1.0.1
create table t1 ( id1 number not null, id2 number not null, n1 number, v1 varchar2(10) ) rowdependencies ; alter table t1 add constraint t1_pk primary key(id1, id2) using index ( create index t1_pk on t1(id1, id2) compress 1 ); create table t2( id1 number not null, id2 number not null, id3 number not null, n1 number, v1 varchar2(10) ) rowdependencies ; alter table t2 add constraint t2_fk_t1 foreign key(id1, id2) references t1;
It’s quite simple – I’ve got a multi-column primary key, and it’s worth compressing on the first column because that column is fairly repetitive. Then I’ve created another table that has a foreign key constraint referencing my first table. Because I’ve got some replication going on and want to enable parallelism I’ve enabled rowdependencies all over the place. So let’s insert a couple of rows and see what happens – the next bit of text is cut-n-pasted from an 11.2.0.4 SQL*Plus session running a script after a call to set echo on:
SQL> insert into t1 values(1,1,1,'x'); 1 row created. SQL> commit; Commit complete. SQL> SQL> insert into t2 values(1,1,1,1,'x'); insert into t2 values(1,1,1,1,'x') * ERROR at line 1: ORA-00600: internal error code, arguments: [25027], [5], [394178], [], [], [], [], [], [], [], [], []
For further details, and before you get completely thrilled at the possibility of compressing lots of indexes, keep an eye on:
Bug 18125878 : ORA-600 [25027] ON INSERT IF TABLE HAS ROWDEPENDENCIES AND COMPRESS ON PK
“Inserting into a table with a foreign key where the base table has a primary key using index key compression and the table also has row dependencies enabled. Stack will include kdsgrds and kdiexi0 (in 12) / kdiexi (in 11, 10)”
As implied by that note from the bug, it also affects 10g. The bug note reports it as fixed in 12.2.
