# Bug COMMS-996 - Search is missing an index for work_package_semantic_aliases which makes it slow

Project: Stream Communicator
Status: closed
URL: https://community.openproject.org/work_packages/COMMS-996

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Search |
| Target versions | 17.9.0, 17.8.1 |
| Observed in versions | 17.8.0 |
| Sprint | Sprint 14 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 17.8.x |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Judith Roth |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Search for a text
    
2.  See that the search is slow
    

### What is the buggy behavior?

It always runs a sequential scan on `work_package_semantic_aliases`, which is quite slow (the bigger the table, the slower the search). The existing btree-index on `work_package_semantic_aliases.identifier` is not used (search is done with `lower` and `LIKE 'prefix%'`)

### What is the expected behavior?

It should use an index and be fast

###   

### Screenshots and other files

See comments for `explain` output before / after

###
