Indexes

This section describes introspection of indexes.

Introspection of the schema::Index:

  1. db>
  2. ...
  3. ...
  4. ...
  5. ...
  6. ...
  7. ...
  8. ...
  9. ...
  10. ...
  11. ...
  1. with module schema
  2. select ObjectType {
  3. name,
  4. links: {
  5. name,
  6. },
  7. properties: {
  8. name,
  9. }
  10. }
  11. filter .name = 'schema::Index';
  1. {
  2. Object {
  3. name: 'schema::Index',
  4. links: {Object { name: '__type__' }},
  5. properties: {
  6. Object { name: 'expr' },
  7. Object { name: 'id' },
  8. Object { name: 'name' }
  9. }
  10. }
  11. }

Consider the following schema:

  1. type Addressable {
  2. property address -> str;
  3. }
  4. type User extending Addressable {
  5. # define some properties and a link
  6. required property name -> str;
  7. multi link friends -> User;
  8. # define an index for User based on name
  9. index on (.name);
  10. }

Introspection of User.name index:

  1. db>
  2. ...
  3. ...
  4. ...
  5. ...
  1. with module schema
  2. select Index {
  3. expr,
  4. }
  5. filter .expr like '%.name';
  1. {
  2. Object {
  3. expr: '.name'
  4. }
  5. }

For introspection of the index within the context of its host type see object type introspection.

See also

Schema > Indexes

SDL > Indexes

DDL > Indexes