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

Cache column option #654

Merged
merged 7 commits into from
Mar 26, 2023
Merged

Cache column option #654

merged 7 commits into from
Mar 26, 2023

Conversation

kbrock
Copy link
Collaborator

@kbrock kbrock commented Mar 26, 2023

  • build_depth_cache_sql! is a faster version of build_depth_cache. Considering dropping the ruby version.
  • dropped ancestry_format
  • merged cache_depth and depth_cache_column options. Unsure which one we should use
  • can use scopes without depth_cache (though you should only use that for background jobs because it will surely do a full table scan)

The boolean flag was redundant for the column
Have kept the previous option available, but included a deprecation message


has_ancestry :cache_depth => "ancestry_depth2"
has_ancestry :cache_depth => true # "ancestry_depth2"

deprecated:

has_ancestry :cache_depth => true, :depth_cache_column => "ancestry_depth2"
a. don't define dynamic methods that will just raise an exception.
b. simpler to just define the scopes by hand than with a loop
The main reason I introduced depth sql is to improve rebuild_depth_cache_sql!
Throwing this into the scopes is a bonus. (but not really)

This works great for the update, but the extra scopes will not perform well.
If you need to use them, consider adding an index on that equation
Use math to adjust the depth_cache instead of re-calculating the depth

I had wanted to use ancestry_depth_sql, but that was using the ancestry value
and putting in the new ancestry value would have been too complicated

goal: remove the regular expression
In our code, if the functionality depends upon the ancestry format,
we need to move that into the format modules
@kbrock kbrock merged commit be23abb into stefankroes:master Mar 26, 2023
@kbrock kbrock deleted the cache_column_option branch March 26, 2023 21:49
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.

1 participant