Constraint doc
:
CREATE TABLE "EVALUATION" (
"EVALUATION_ID" NUMBER(20, 0) NOT NULL ENABLE,
ENABLE/DISABLE
indicates that constraint is on or off. By default ENABLE
is used.
ENABLE Clause Specify ENABLE if you want the constraint to be applied
to the data in the table.
DISABLE Clause Specify DISABLE to disable the integrity constraint.
Disabled integrity constraints appear in the data dictionary along
with enabled constraints. If you do not specify this clause when
creating a constraint, Oracle automatically enables the constraint.
Constraints are used to ensure data integrity, but there are scenarios we may need to disable them.
Managing Integrity
:
Disabling Constraints
To enforce the rules defined by integrity constraints, the constraints
should always be enabled. However, consider temporarily disabling the
integrity constraints of a table for the following performance
reasons:
When loading large amounts of data into a table
When performing batch operations that make massive changes to a table (for example, changing every employee's number by adding 1000 to
the existing number)
When importing or exporting one table at a time
In all three cases, temporarily disabling integrity constraints can
improve the performance of the operation, especially in data warehouse
configurations.
It is possible to enter data that violates a constraint while that
constraint is disabled. Thus, you should always enable the constraint
after completing any of the operations listed in the preceding bullet
list.
Efficient Use of Integrity Constraints: A Procedure
Using integrity constraint states in the following order can ensure
the best benefits:
Disable state.
Perform the operation (load, export, import).
Enable novalidate state.
Some benefits of using constraints in this order are:
No locks are held.
All constraints can go to enable state concurrently.
Constraint enabling is done in parallel.
Concurrent activity on table is permitted.
EDIT:
The question is rather why to use obvious keyword when it is turn on by default:
I would say:
- For clarity (Python EIBTI rule Explicit Is Better Than Implicit)
- For completness
- Personal taste and/or coding convention
This is the same category as:
CREATE TABLE tab(col INT NULL)
Why do we use NULL
if column is nullable by default.