Proof that not null constraints on primary key columns are checked twice
130180Apr 9 2009 — edited Apr 9 2009Hi
I am working on a table that has been created with not null check constraints on primary key columns.
I need to prove that not only is this not necessary, but whether the database checks this column twice.
I have created a test table with this issue, inserted a million rows and timed the run, then repeated with the check constraint disabled.
After running a few times, it is consistent that the constraint enabled run is about 70 seconds, as opposed to 60 seconds when disabled.
Although this helps, I don't think this is proof.
I traced the run and tkprof'd the output, but can't find reference to constraint checking in the report.
So, question:
Is there any way I can show for sure if Oracle is double checking the constraint?
Also:
Apart from self documentation, is there any other reason why these not null constraints were applied to PK columns? I can't think of one.......
Many thanks in advance
Chris