Skip to content

Conversation

@rahuld109
Copy link
Contributor

@rahuld109 rahuld109 commented Dec 14, 2025

Description

Add analyze_graph() and delete_graph_statistics() methods to the Memgraph class for calculating and managing graph statistics used for index optimization.

Usage:

from gqlalchemy import Memgraph

memgraph = Memgraph()

# Analyze all labels
results = memgraph.analyze_graph()

# Analyze specific labels
results = memgraph.analyze_graph(labels=["Person", "Company"])

# Delete all statistics
deleted = memgraph.delete_graph_statistics()

# Delete statistics for specific labels
deleted = memgraph.delete_graph_statistics(labels=["Person"])

Pull request type

  • Feature

Related issues

Closes #238

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Add analyze_graph() and delete_graph_statistics() methods to the
Memgraph class for calculating and managing graph statistics used
for index optimization.

- analyze_graph(): Runs ANALYZE GRAPH query, optionally filtering by labels
- delete_graph_statistics(): Runs ANALYZE GRAPH DELETE STATISTICS query

Closes memgraph#238
@CLAassistant
Copy link

CLAassistant commented Dec 14, 2025

CLA assistant check
All committers have signed the CLA.

Add optional labels parameter to delete_graph_statistics() to support
ANALYZE GRAPH ON LABELS :Label1 DELETE STATISTICS; syntax.

Also fix return type - DELETE STATISTICS returns deleted index info.
Copy link
Contributor

@antejavor antejavor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, let's wait for CI.

@antejavor antejavor merged commit f212d3a into memgraph:main Dec 16, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ANALYZE GRAPH query to query builder

4 participants