Zum Inhalt springen

Unbounded Query No Limit (ARCH6061)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key ruby.orm.unbounded-query-no-limit · Severity info · Category orm

Fetching an entire table with no LIMIT or pagination risks memory blowup on large tables when the result feeds a list or response.

def index
render json: User.all # whole table into memory and the response
end
def index
render json: User.limit(50).offset(params[:offset].to_i)
end

Add limit and pagination to queries that feed a list/response to avoid fetching the whole table.