DROP PRIMARY INDEX
The DROP PRIMARY INDEX statement allows you to drop an unnamed primary indexes.
|Named primary indexes that are created using CREATE PRIMARY INDEX, can only be dropped using the DROP INDEX command.|
DROP PRIMARY INDEX ON named_keyspace_ref [USING GSI];
[ namespace-name :] keyspace-name
identifier that refers to the bucket name. Specifies the bucket as source for which the index needs to be created. You can add an optional namespace name to the keyspace name in this way:
namespace-name : keyspace-name
Currently, only the
default namespace is available.
default:`travel-sample` indicates the
travel-sample keyspace in the
If the namespace name is omitted, the default namespace in the current session is used.
In Couchbase Server 6.5 and later, the index type for a primary index must be Global Secondary Index (GSI).
USING GSI keywords are optional and may be omitted.
User executing the DROP PRIMARY INDEX statement must have the Query Manage Index privilege granted on the keyspace/bucket. For more details about user roles, see Roles.
The following example creates a primary index on the beer-sample bucket. Once the index creation statement comes back, system:indexes is queried for status of the index.
CREATE PRIMARY INDEX ON `beer-sample` USING GSI; SELECT * FROM system:indexes;
Subsequently, the unnamed primary index is dropped with the following statement and it no longer is reported in the system:indexes output.
DROP PRIMARY INDEX ON `beer-sample` USING GSI; SELECT * FROM system:indexes;