Server crashes while creating index on agtype_access_operator in a big database
- Dominant language
- C
- Stars
- 4.8k
- Forks
- 523
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 9
Description
**Describe the bug**
I am trying to create an index on this expression- `agtype_access_operator(VARIADIC ARRAY[properties, '"knownForTitles"'::agtype])` to improve performance of a MATCH query containing `.. WHERE x.knownForTitles = ..`.
My local machine freezes for a while, followed by the server crash,
**How are you accessing AGE (Command line, driver, etc.)?**
- Command Line
**What data setup do we need to do?**
Using a _big_ movie database. The label `Person` contains 12,637,040 nodes.
**What is the necessary configuration info needed?**
- N/A
**What is the command that caused the error?**
```pgsql
CREATE INDEX btree_person_knownFor_Titles
ON imdb."Person"
USING btree (agtype_access_operator(VARIADIC ARRAY[properties, '"knownForTitles"'::agtype]));
```
**Expected behavior**
Create index without crashing.
**Environment (please complete the following information):**
- PostgreSQL 15.4
- AGE master branch
**Additional context**
The same command on a smaller database (~50k nodes) finishes successfully.
If the expression is used in a `SELECT` (as opposed to `CREATE INDEX`) command, it finishes successfully on the big database.
```sql
SELECT (agtype_access_operator(VARIADIC ARRAY[properties, '"knownForTitles"'::agtype])) from imdb."Person";
```
This is likely a memory leak issue. The crash is not caused by segmentation fault since it was not caught by the debugger.
Contributor guide
Assessment
This issue has not been assessed yet.