Cost of using `Documents` vs default index

If you create a “default index”, does it alias the built-in one available through Documents(Collection(/*...*/))? That is, does it cost more indexing space to create a default index?

I’m using “default index” to mean one that has no terms or values.

For example:

CreateIndex({
  name: 'my_default_index',
  source: Collection('some_collection'),
  serialized: true
})

Another way to ask, does it save any DB costs to refactor an app to use Documents and avoid creating a default index?

Interesting side question (purely academic, because I don’t know why this would be useful), if multiple default indexes are created for the same Collection, are they all aliased or does each one actually get created and store another copy of the index data?

@ptpatersonDocuments() index and default index are independent of each other. The default index is a duplicate of the inbuilt Documents() index. It can cost additional storage and write ops. More info here. Multiple default indexes would be independent of each other.

default index was recommended to get all documents from a Collection before the Documents() index was introduced. Users should leverage Documents() index when possible.

2 Likes

It’s a bummer that the canonical way of adding “all_X” queries to GraphQL duplicates data. It’s of course possible to use @resolver instead of @index, but that is not very obvious to a newcomer.

From an all-FQL approach, though, I am all set, and thank you! Where I have some logic being reused, I can switch from passing around Indexes to Sets to use Documents in arguments.