Skip to content

Conversation

@dimitrovmaksim
Copy link
Member

Resolves #4579

What this PR does:

  1. Adds a new materialized view info.table_stats that aggregates statistics from pg_stats for subgraph entity tables, calculating estimated unique entities, total versions, and uniqueness ratio.
  2. Adds a optional experimental background job querying the view to find eligible tables and setting the is_account_like flag. The job can be enabled by setting the following env vars
  • GRAPH_STORE_ACCOUNT_LIKE_SCAN_INTERVAL_HOURS
  • GRAPH_STORE_ACCOUNT_LIKE_MIN_VERSION_COUNT
  • GRAPH_STORE_ACCOUNT_LIKE_MAX_UNIQUE_RATIO
  1. Updates the ENV vars documentation with the new variables and their usage.

@dimitrovmaksim dimitrovmaksim changed the title Feature/automate account like optimization Feat: Automate account-like optimization Nov 6, 2025
@dimitrovmaksim dimitrovmaksim self-assigned this Nov 6, 2025
@fordN fordN requested a review from lutter November 11, 2025 17:09
@dimitrovmaksim dimitrovmaksim force-pushed the feature/automate-account-like-optimization branch from bab38bb to db82636 Compare December 3, 2025 13:31
@dimitrovmaksim dimitrovmaksim force-pushed the feature/automate-account-like-optimization branch from db82636 to 544d698 Compare December 16, 2025 21:44
Copy link
Collaborator

@lutter lutter left a comment

Choose a reason for hiding this comment

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

Looks good, but would be nice to avoid the nameclash I noted.

@@ -0,0 +1,35 @@
CREATE MATERIALIZED VIEW info.table_stats AS
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's a little unfortunate that we already have a subgraphs.table_stats which has a completely different meaning. It might be good to use a different name here, maybe entity_version_stats, though more than happy with something else

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess it is true that the hardest thing in development is naming stuff :D

Removed the previous migration and added a new one with the name of the view changed to your suggestion

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.

[Feature] Automate setting of account-like optimization

2 participants