MetaCredo.Check.Warning.InefficientFilter (MetaCredo v0.1.0)

View Source

Detects the pattern of fetching all records from the database (e.g. Repo.all(User)) and then filtering them in memory with Enum.filter/2 or Enum.reject/2. This wastes bandwidth, memory, and CPU.

Push the filter down to the database using Ecto.Query.where/3 or equivalent query-level filtering.

Category: Warning / Priority: high