Knowledgebase

Querying With Eloquent Print

  • phplaravel, performance, errors, guide, howto, solution, zillionkinghost, hosting
  • 0

Retrieving data.

WHAT YOU CAN DO

Filter, sort, limit, group and aggregate, without writing queries.

WHAT TO PREFER

Retrieving only the columns you need Retrieving only the rows you need

WHY

Loading whole tables into memory is a common cause of failure.

WHAT TO USE FOR LARGE RESULTS

Processing in chunks, rather than loading everything.

WHAT RETURNS WHAT

A single record, or nothing A collection, possibly empty

WHAT TO HANDLE

The case where nothing is found.

WHAT TO USE WHEN ABSENCE IS AN ERROR

The variant that fails, producing a not-found response automatically.

WHAT TO BE CAREFUL WITH

Queries inside loops Conditions built from input without validation

WHAT PARAMETERISATION HAPPENS AUTOMATICALLY

Values in standard query methods.

WHAT DOES NOT

Raw expressions, and dynamic column names.

WHAT TO DO ABOUT THOSE

Bind values explicitly, and validate column names against a permitted list.

WHAT TO INSPECT WHEN SOMETHING IS SLOW

The generated queries and their count.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot