Skip to content

Unwind edge creation infinite time/super slow #1713

@ExtReMLapin

Description

@ExtReMLapin

Hello

ArcadeDB Version:

ArcadeDB Server v24.6.1 (build fbc1c77c7e1c52197abdd8661e5b34749babf3d6/1721708610769/main)

OS and JDK Version:

Running on Linux 6.5.0-41-generic - OpenJDK 64-Bit Server VM 11.0.23

Expected behavior

Non slow/infinite time request

Actual behavior

Well the query is slow as hell

Steps to reproduce

Before the release of our tool we're doing "fuzzing" or just trying absurd quantity of thing with absurd quantity of data.

We realized we need to optimize our queries by not creating one edge by one edge and batching it.

Issue is that ... it's not helping.

Creating 5 edges (batches with UNWIND in Cypher) is ... stuck

Attached database :
transports.zip

Query ran in Postman.

URL: api/v1/query/TRANSPORTSEASY

Body :

{
  "command": "        UNWIND $batch as row\n        MATCH (a), (b)\n        WHERE ID(a) = row.source_id AND ID(b) = row.target_id\n        CREATE (a)-[r:RELATION {relation_type: row.relation_type}]->(b)\n        SET r.similarity = row.features.similarity RETURN a, b, r\n",
  "language": "cypher",
  "params": {
    "batch": [
      {
        "source_id": "#22:8200",
        "target_id": "#1:0",
        "relation_type": "smiliar",
        "features": {
          "similarity": 1
        }
      },
      {
        "source_id": "#22:8200",
        "target_id": "#7:8198",
        "relation_type": "smiliar",
        "features": {
          "similarity": 1
        }
      },
      {
        "source_id": "#22:8200",
        "target_id": "#10:8199",
        "relation_type": "smiliar",
        "features": {
          "similarity": 1
        }
      },
      {
        "source_id": "#22:8200",
        "target_id": "#13:8199",
        "relation_type": "smiliar",
        "features": {
          "similarity": 1
        }
      },
      {
        "source_id": "#22:8200",
        "target_id": "#16:8199",
        "relation_type": "smiliar",
        "features": {
          "similarity": 1
        }
      },
      {
        "source_id": "#22:8200",
        "target_id": "#19:8199",
        "relation_type": "smiliar",
        "features": {
          "similarity": 1
        }
      }
    ]
  }
}

Multi line cypher query is :

UNWIND $batch as row
        MATCH (a), (b)
        WHERE ID(a) = row.source_id AND ID(b) = row.target_id
        CREATE (a)-[r:RELATION {relation_type: row.relation_type}]->(b)
        SET r.similarity = row.features.similarity RETURN a, b, r

Editing the query to make batch list empty fixes the issue.

Metadata

Metadata

Assignees

Labels

wontfixThis will not be worked on

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions