Skip to content

Conversation

@yfukai
Copy link
Contributor

@yfukai yfukai commented Dec 10, 2025

This pull request introduces a new feature for the SQLGraph backend: the ability to create explicit database indexes on node and edge attributes to improve query performance, especially for frequently filtered attributes. The documentation and tests have been updated to reflect and validate this functionality.

SQLGraph indexing improvements:

  • Added methods ensure_node_attr_index and ensure_edge_attr_index to SQLGraph for creating indexes on node and edge attribute columns, including support for composite and unique indexes. (src/tracksdata/graph/_sql_graph.py)
  • Updated documentation to describe the new index feature and provide usage examples for creating indexes on attributes. (docs/concepts.md)
  • Updated the project README to mention SQLGraph's ability to index frequently queried attributes for faster filtering. (README.md)

Testing and validation:

  • Added tests to ensure index creation works as expected, including checks for composite and unique indexes, and error handling for missing columns. (src/tracksdata/graph/_test/test_graph_backends.py)
  • Added sqlalchemy import to support index inspection in tests. (src/tracksdata/graph/_test/test_graph_backends.py)

JoOkuma and others added 30 commits November 5, 2025 10:56
Co-authored-by: Jordão Bragantini <jordao.bragantini@gmail.com>
Co-authored-by: Jordão Bragantini <jordao.bragantini@gmail.com>
Co-authored-by: Jordão Bragantini <jordao.bragantini@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.45%. Comparing base (c5af9f3) to head (3594699).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/tracksdata/graph/_sql_graph.py 83.33% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #223      +/-   ##
==========================================
- Coverage   88.45%   88.45%   -0.01%     
==========================================
  Files          55       55              
  Lines        3890     3976      +86     
  Branches      674      694      +20     
==========================================
+ Hits         3441     3517      +76     
- Misses        267      275       +8     
- Partials      182      184       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yfukai
Copy link
Contributor Author

yfukai commented Dec 10, 2025

Maybe we need drop functions

Copy link
Member

@JoOkuma JoOkuma left a comment

Choose a reason for hiding this comment

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

@yfukai, awesome PR, I had hadn't thought of adding this.

Comment on lines +25 to +26
SQLGraph lets you create indexes on node or edge attributes to keep repeated
filters fast:
Copy link
Member

Choose a reason for hiding this comment

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

@yfukai this is awesome. Could you briefly mention what kind of speed-up we can expect with this? 2x, 10x?

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.

3 participants