Configuring Cloud Save indexes?

Hi everyone,

We have been testing usage of Cloud Save, using queries and indexes.
Multiple property queries seem to work even though the properties involved have only separate single indexes configured for them (not compound indexes). Is that right ? Are we getting hit on performance ? Aren’t we supposed to define compound indexes for such cases ? If not, then for what cases compound indexes are needed for ?

The documentation says very little on this, just mentions queries and indexes and no mention of the need to define compound indexes or anything lie that -

The setup we checked -

We have a Cloud Save custom item (Game Data) set up with 3 sample properties - prop1, prop2 and … prop3. Each has an asc single separate index configured for it.

Trying to run this query seems to work -

    var query = new QueryIndexBody(
        fields:
        [
            new FieldFilter("prop1", "someValue1", FieldFilter.OpEnum.EQ),
            new FieldFilter("prop2", "someValue2",  FieldFilter.OpEnum.EQ)
        ],
        returnKeys: ["someKey"]
    );

Trying to filter one of them to FieldFilter.OpEnum.NE also seems to work.
Even using range filters seem to work

    var query = new QueryIndexBody(
        fields: [
            new FieldFilter("prop1", "someValue1", FieldFilter.OpEnum.EQ),
            new FieldFilter("prop2", "someValue2".ToString(),  FieldFilter.OpEnum.EQ),
            new FieldFilter("prop3", value3, FieldFilter.OpEnum.LT)
        ],
        returnKeys: ["someKey"]
    );

Anyone with experience on this ?

Thanks !

Hey danibacon - yes, this is expected.

Queries don’t require a compound index that matches every filtered property; as long as at least one of the properties in your query is indexed, the query is accepted and returns correct results.

That said, for queries that combine multiple properties, we’d recommend defining a compound index over those properties. With only single indexes, the query is driven by one of them and the remaining conditions are applied afterwards - that works, but a compound index will perform better and scale more predictably as your data grows.

Hey Jamie

Pardon the delay, thank you so much for your attention and clarification.
I’ve been corresponding with Unity support on the matter which happily led to some updates with some details in Cloud Save documentation -

Any further documentation on internals and recommendations will be great.
Much appreciated !