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

is it possible to only use deterministic order where parent_id is not null? #282

Open
robguthrie opened this issue Aug 26, 2017 · 2 comments

Comments

@robguthrie
Copy link

Hello!

I'm looking at using closure_tree on a table with 4 million rows, I want to use a deterministic integer order but only where the record has a parent. Is that possible?

Right now it seems to be trying to put a sequence over all the records in the table, which is taking too long.

@robguthrie
Copy link
Author

I've just tried

      def reorder_with_parent_id(parent_id, minimum_sort_order_value = nil)
        return if parent_id.nil?

Which seems to avoid the issue. Should I try to make this a config option?

@smoyte
Copy link
Contributor

smoyte commented May 29, 2018

@robguthrie So does this mean your roots have nil rank? Or do you set them to default to 0 or 1 or something?

Did you make any progress adding this as a config option?

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

No branches or pull requests

2 participants