graphprotocol / graphprotocol/graph-node
Use prefix comparison for `starts_with`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 1.1k
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 1
Description
A GraphQL query that contains a clause name_starts_with: .. gets translated to SQL as name like '...%'. On String and Bytes columns, we only index a prefix of these columns so that the index is not usable for that clause.
Query generation should be changed to generate something like left(name, 256) like '...%' if the search term is shorter than 256 characters, and to left(name, 256) = left('...', 256) and name like '...%' if the search term is longer than that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the GraphQL name_starts_with entry point and the SQL query generation for String and Bytes columns. Verify the generated SQL uses the 256-character prefix comparison for shorter and longer search terms, while retaining the name like '...%' condition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, rust, sql
- Domain
- api, backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100