Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Index not used when AND is added to WHERE clause #3407

Closed
2 tasks done
ioannist opened this issue Jan 27, 2024 · 2 comments
Closed
2 tasks done

Bug: Index not used when AND is added to WHERE clause #3407

ioannist opened this issue Jan 27, 2024 · 2 comments
Assignees
Labels
bug Something isn't working topic:indexing This is related to indexing and full-text search

Comments

@ioannist
Copy link

ioannist commented Jan 27, 2024

Describe the bug

Create a table and create an index:
DEFINE INDEX blockIndex ON TABLE table FIELDS block

This query (1) returns all results
SELECT * FROM table WHERE block = 10

This query (2) times out (looks like the index is not used):
SELECT * FROM table WHERE block = 10 AND observation.value.num IS NOT NONE

This query (3) executes successfully and returns the correct results:
SELECT * FROM (SELECT * FROM table WHERE block = 10) WHERE observation.value.num IS NOT NONE

Steps to reproduce

See above. You might have to enter many records to make the second query time out. Alternatively, you can check if the index is being used.

Expected behaviour

Query 2 should work and return the same results as query 3.

SurrealDB version

v1.1.1

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@ioannist ioannist added bug Something isn't working triage This issue is new labels Jan 27, 2024
@emmanuel-keller emmanuel-keller self-assigned this Jan 30, 2024
@emmanuel-keller emmanuel-keller added topic:indexing This is related to indexing and full-text search and removed triage This issue is new labels Jan 30, 2024
@prabirshrestha
Copy link

This seems to be dupe of #2900

@ioannist
Copy link
Author

ioannist commented Feb 9, 2024

Indeed, this is the same issue. Closing in favor of #2900

@ioannist ioannist closed this as completed Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working topic:indexing This is related to indexing and full-text search
Projects
None yet
Development

No branches or pull requests

3 participants