Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

db index on version column #27

Open
UniIsland opened this issue Oct 8, 2016 · 1 comment · May be fixed by #67
Open

db index on version column #27

UniIsland opened this issue Oct 8, 2016 · 1 comment · May be fixed by #67

Comments

@UniIsland
Copy link

Why don't we add an index to the version column and modify the TaskRecord.completed_task? method as shown below, to make it more efficient?

from:

def self.completed_task?(version)
  all.any?{|t| t.version == version}
end

to:

def self.completed_task?(version)
  exists?(version: version)
end

This is way more efficient when you use it for a while and have lots of tasks there.

BTW, the uniqueness of version field should be enforced.

@michaelirey
Copy link
Collaborator

@UniIsland Sorry for the super delayed response. These are really great ideas. I'll see about including this in the next update.

@snow snow linked a pull request Sep 26, 2022 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants