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

Match index degeneration #3246

Closed
czpmango opened this issue Nov 2, 2021 · 0 comments · Fixed by #3311
Closed

Match index degeneration #3246

czpmango opened this issue Nov 2, 2021 · 0 comments · Fixed by #3311
Assignees
Labels
type/bug Type: something is unexpected
Milestone

Comments

@czpmango
Copy link
Contributor

czpmango commented Nov 2, 2021

Currently, Indexes of match statements have the following degradation related issues:

1. FullTagScan cannot be degraded if the index is not selected

(czp@nebula) [nba]> show tag indexes
+---------------------+----------+----------+
| Index Name          | By Tag   | Columns  |
+---------------------+----------+----------+
| "player_name_index" | "player" | ["name"] |
+---------------------+----------+----------+
| "team_name_index"   | "team"   | ["name"] |
+---------------------+----------+----------+
Got 2 rows (time spent 2985/3978 us)

Query 1:
match (v:player)
return v

Query 2:
match (v:player)
where v.age>40
return v

Query 1(expected): FullTagScan
Query 2(unexpected): The execution result is an error. The expectation is to degenerate to FullTagScan when there is no index on player(age).

2. A low-priority index cannot be degraded if a high-priority index is not selected

(czp@nebula) [nba]> show tag indexes
+---------------------+----------+----------+
| Index Name          | By Tag   | Columns  |
+---------------------+----------+----------+
| "player_name_index" | "player" | ["name"] |
+---------------------+----------+----------+
| "team_name_index"   | "team"   | ["name"] |
+---------------------+----------+----------+
Got 2 rows (time spent 3728/4894 us)

Query 3:
match (v:player)
where v.name=="Tim"
return v

Query 4:
match (v:player)
where v.name=="Tim" and v.age==40
return v

Query 3(expected): PrefixIndex(player.name)
Query 4(unexpected): The execution result is an error. The expectation is to degenerate to PrefixIndex(player.name) when there is no index on player(name,age).

3. The composite index was not selected as expected

(czp@nebula) [nba]> show tag indexes
+----------------------+----------+-----------------+
| Index Name           | By Tag   | Columns         |
+----------------------+----------+-----------------+
| "player_age_index"   | "player" | ["age"]         |
+----------------------+----------+-----------------+
| "player_multi_index" | "player" | ["name", "age"] |
+----------------------+----------+-----------------+
| "player_name_index"  | "player" | ["name"]        |
+----------------------+----------+-----------------+
| "team_name_index"    | "team"   | ["name"]        |
+----------------------+----------+-----------------+
Got 4 rows (time spent 3328/4334 us)

Query 5:
match (v:player)--(n:team)
where v.name=="Tim" and v.age>40
return v

Query 6:
match (v:player)--(n:team)
where v.name=="Tim" and v.age>40 and v.name=="Tim"
return v

Query 5(expected): CompositeIndex(name,age)
Query 6(unexpected): The execution result is an error. The expected index is CompositeIndex(name,age)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Type: something is unexpected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants