gpt4 book ai didi

sql - 使用索引子句

转载 作者:行者123 更新时间:2023-12-04 15:34:11 26 4
gpt4 key购买 nike

我在db修补程序中看到以下语句:

ALTER TABLE tablename ADD PRIMARY KEY (somepk_columnname) USING INDEX;

我想在这里查看USING INDEX的功能,但只能从Google那里获得,它可以让我指定一些特定于存储的内容,等等。

我的问题确实是,这里到底会发生什么?数据库在这里使用一些默认值吗?在默认表空间中为PK创建索引吗?我以为每个默认的每个pk都会创建一个索引...

最佳答案

http://docs.oracle.com/cd/B28359_01/server.111/b28286/clauses002.htm#SQLRF52209

Using Indexes to Enforce Constraints

When defining the state of a unique or primary key constraint, you can specify an index for Oracle to use to enforce the constraint, or you can instruct Oracle to create the index used to enforce the constraint.

using_index_clause You can specify the using_index_clause only when enabling unique or primary key constraints. You can specify the clauses of the using_index_clause in any order, but you can specify each clause only once.

If you specify schema.index, then Oracle attempts to enforce the constraint using the specified index. If Oracle cannot find the index or cannot use the index to enforce the constraint, then Oracle returns an error.

If you specify the create_index_statement, then Oracle attempts to create the index and use it to enforce the constraint. If Oracle cannot create the index or cannot use the index to enforce the constraint, then Oracle returns an error.

If you neither specify an existing index nor create a new index, then Oracle creates the index. In this case:

The index receives the same name as the constraint.

If table is partitioned, then you can specify a locally or globally partitioned index for the unique or primary key constraint.

关于sql - 使用索引子句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23243479/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com