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

EXPLAIN on cypher DELETE is very slow. #2140

Open
lyp-bobi opened this issue Dec 16, 2024 · 2 comments
Open

EXPLAIN on cypher DELETE is very slow. #2140

lyp-bobi opened this issue Dec 16, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@lyp-bobi
Copy link

lyp-bobi commented Dec 16, 2024

Describe the bug

On my graph, the deletion of vertex is extremely slow. So I use EXPLAIN to print its plan. However, the EXPLAIN takes nearly the same time as of the original deletion.

How are you accessing AGE (Command line, driver, etc.)?

PostgreSQL 14, psql, AGE 1.5.0

What data setup do we need to do?

I guess you can reproduce it on any data.

What is the necessary configuration info needed?

What is the command that caused the error?

My SQL is:

explain SELECT *
        FROM cypher('ldbc_graph', $$
            MATCH (person:Person {id: 111})-[l:LIKES]->(post:Post {id: 222})
            DELETE l
        $$) AS (res1 agtype);

I pstack it and see it is working on 'end_cypher_delete->check_for_connected_edges'

Expected behavior

There are two major expectation:

  1. The EXPLAIN command on deletion should not use that hook to delete the connected edges.
  2. I have built btree index on (start_id, end_id) to accelerate my MATCH cyphers. I guess it is also possible to delete the connected edges through that index, to make it faster, instead of scanning the full table?

Environment (please complete the following information):

  • Version: [e.g. 0.4.0]

1.5.0

Additional context
Add any other context about the problem here.

@lyp-bobi lyp-bobi added the bug Something isn't working label Dec 16, 2024
Copy link

This issue is stale because it has been open 60 days with no activity. Remove "Abondoned" label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale Stale issues/PRs label Feb 15, 2025
@jrgemignani
Copy link
Contributor

jrgemignani commented Feb 15, 2025

@lyp-bobi The EXPLAIN command, for openCypher commands, needs to be inside the cypher function -

SELECT *
        FROM cypher('ldbc_graph', $$ EXPLAIN
            MATCH (person:Person {id: 111})-[l:LIKES]->(post:Post {id: 222})
            DELETE l
        $$) AS (res1 agtype);

Additionally, EXPLAIN, by itself, will only stop execution of the command, not anything that is part of parsing and optimizing.

@github-actions github-actions bot removed the Stale Stale issues/PRs label Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants