CREATE INDEX on Scope and Collection


Will the create index below scan the whole bucket or just the “landmark” collection in the “inventory” scope.

CREATE INDEX idx1 ON travel-sample.inventory.landmark(country)

I want to create scopes dynamically as such need to create indexes within the scope dynamically as well. The number of scopes created is large and I don’t want the system to suffer the rescan of the whole bucket every time a scope is created.

Many thanks for the reply.

With gratitude,
Neome Web

DDL, DMLs are specific to collection. i.e index only scan landmark collection with in the travel-sample bucket inventory scope.

CREATE INDEX idx2 ON travel-sample(country) is same as Within the bucket _default scope _default collection. It will not scan any other scope or collection with in the same bucket

CREATE INDEX idx2 ON travel-sample._default._default(country) ;

The bucket level once more backward compatibility , under neath all data moved to _default scope _default collection. All bucket level DML/DDLs uses mapped name internally.

1 Like

I guessed so.

So, dynamically creating an empty scope with collections and indexes on these collections won’t be computationally taxing.

I wish FTS (search) also was scope oriented. I am still figuring things out with regards to FTS vis-a-vis Querying.