1

How do you define a composite index in EdgeDB?

The documentation states:

The simplest form of index is an index, which references one or more properties directly:

type User {
    property name -> str;
    index on (__subject__.name);
}

but I couldn't find a way to reference multiple properties in an index.

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262

1 Answers1

2

You can add index on (...) to the containing type, where ... is an arbitrary scalar expression. To create a composite index it should be a tuple (x, y):

type User {
    property first_name -> str;
    property last_name -> str;
    index on ((.first_name, .last_name));
}

source

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262