Skip to content

`Project.all` here is not memory efficient

Matthias Käppler requested to merge github/fork/zenati/patch-3 into master

Created by: zenati

@limit_project_ids is supposed here to contain an array of ids.

Project.pluck(:id) is better than Project.all because:

  • :all will run a select * and initialize n activerecord objects in memory, where n is the count of all projects. It's not memory efficient.
  • :all returns an activerelation, but here we only need an array of ids
  • :pluck returns what's needed without initializing objects.

Merge request reports