yii\db\Query::indexBy()

Can someone explain how this method (yii\db\Query::indexBy()) work, what do? Sorry for my english. What’s idea that method.

If you return an array of rows from the db, it will be indexed in a numeric sequence. Often it makes access to an array easier if you can index it by a column in your database, usually the id field, so that the array key matches the id field and rather than looping through an array to find the correct id, you can just use the array key.