Currently, this is not possible. With this small patch it seems to work fine (more extensive tests are needed).

In hook_field_settings(database columns) you need to add "index => TRUE" for each column that you want to have an index for.

CommentFileSizeAuthor
indices.patch3.14 KBkilles@www.drop.org

Comments

yched’s picture

Status: Needs review » Closed (duplicate)

The main concern with this approach is that it creates indexes for all fields of a given type, which leads to index bloat, whereas the actual need for indexes is usage-driven (Views, custom queries...)

See #231453: Allow indexing columns for the existing thread about indexes and my current proposal for this.