K
K
knowledge2018-06-20 23:05:09
Database
knowledge, 2018-06-20 23:05:09

How to use Explain in Eloquent?

Good afternoon,
I figured out how to add an index to a table in eloquent, for example, for the user_id field

Capsule::schema()->create('just', function($table){
  $table->increments('id');
  $table->integer('user_id');
        $table->index('user_id');
  $table->timestamps();
});

but how can the EXPLAIN command be used to see slow queries and consequent improvements after adding indexes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-06-20
@knowledge

EXPLAIN is outside the scope of orm.
get the sql query generated by the debugger and explicate it in the db console or any GUI db tool.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question