在oracle数据库语句中使用ENABLE关键字的原因/用处是什么
What's the reason / usefulness is to use ENABLE keyword in oracle database statements
我想知道在以下语句中使用 ENABLE 关键字的优点或用处是什么:
CREATE TABLE "EVALUATION" (
"EVALUATION_ID" NUMBER(20, 0) NOT NULL ENABLE,
或
ALTER TABLE "EVALUATION"
ADD CONSTRAINT("EVALUATION_FK")
FOREIGN KEY ("CREW_ID")
REFERENCES "CREW" ("CREW_ID") ENABLE;
根据我在文档中阅读的内容,ENABLE
默认处于打开状态。
我可以假设它只是为了启用以前禁用的东西吗?
CREATE TABLE "EVALUATION" (
"EVALUATION_ID" NUMBER(20, 0) NOT NULL ENABLE,
ENABLE/DISABLE
表示约束打开或关闭。默认使用 ENABLE
。
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.
约束用于确保数据完整性,但在某些情况下我们可能需要禁用它们。
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.
编辑:
问题是为什么在默认情况下打开 obvious 关键字:
我会说:
- 为清楚起见(Python EIBTI 规则显式优于隐式)
- 为了完整性
- 个人品味and/or编码约定
这与以下类别相同:
CREATE TABLE tab(col INT NULL)
如果列默认可为空,为什么我们使用 NULL
。
我想知道在以下语句中使用 ENABLE 关键字的优点或用处是什么:
CREATE TABLE "EVALUATION" (
"EVALUATION_ID" NUMBER(20, 0) NOT NULL ENABLE,
或
ALTER TABLE "EVALUATION"
ADD CONSTRAINT("EVALUATION_FK")
FOREIGN KEY ("CREW_ID")
REFERENCES "CREW" ("CREW_ID") ENABLE;
根据我在文档中阅读的内容,ENABLE
默认处于打开状态。
我可以假设它只是为了启用以前禁用的东西吗?
CREATE TABLE "EVALUATION" (
"EVALUATION_ID" NUMBER(20, 0) NOT NULL ENABLE,
ENABLE/DISABLE
表示约束打开或关闭。默认使用 ENABLE
。
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.
约束用于确保数据完整性,但在某些情况下我们可能需要禁用它们。
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.
编辑:
问题是为什么在默认情况下打开 obvious 关键字:
我会说:
- 为清楚起见(Python EIBTI 规则显式优于隐式)
- 为了完整性
- 个人品味and/or编码约定
这与以下类别相同:
CREATE TABLE tab(col INT NULL)
如果列默认可为空,为什么我们使用 NULL
。