Adding an index causes the result to become smaller. · Issue #3238 · RedisGraph/RedisGraph · GitHub
Skip to content

Adding an index causes the result to become smaller. #3238

Open

Description

@sjhhh321

When we add an index, it may alter the query plan of a query.For the same statement, the result should be the same regardless of whether an index is used. However, I found a logic bug in this case.
This is my cypher query:
MATCH (n1 :L1)-[r1 :T0]->(n2 :L4) WHERE ((n2.k28) < 'a') RETURN *
This is its query result:
Image

Then I added this index:CREATE INDEX ON:L4(k28)
and executed the same query again,this is its result:
Image
However, this issue doesn't occur every time—it only happens when adding the index causes the query plan to change. I used RedisInsight to examine the change in the query plan and found that the plan before and after adding the index changed in the following way:

Image
after add index:
Image

Redis version: redis-7.2.4
RedisGraph version: redisgraph-2.12.10
Operating system: Ubuntu 20.04
Here is the dataset:

database.log

Activity

  1. changed the title [-]I found a logic bug when adding an index.[/-] [+]Adding an index causes the result to become smaller.[/+] on Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions