Extra information about the query

You can call the explain() method on queries to know extra information about the query.

1Book::where('name', 'Ruskin Bond')->explain()->dd();
1Illuminate\Support\Collection {#5344
2 all: [
3 {#15407
4 +"id": 1,
5 +"select_type": "SIMPLE",
6 +"table": "books",
7 +"partitions": null,
8 +"type": "ALL",
9 +"possible_keys": null,
10 +"key": null,
11 +"key_len": null,
12 +"ref": null,
13 +"rows": 9,
14 +"filtered": 11.11111164093,
15 +"Extra": "Using where",
16 },
17 ],
18}

Tip given by @amit_merchant

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 22 courses (477 lessons, total 38 h 20 min)
  • 2 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord