Skip to content

Yii2 mongodb ActiveRecord select query very slow event if there have many rows.  #264

Open
@nishanthrk

Description

@nishanthrk

What steps will reproduce the problem?

using yii\mongodb\Query;
$query->select(['data'])
->from('log')
->where(['userId' => 12234])
->limit(10);

using ActiveRecord
$result = Log::find()
->select(['data'])
->where(['userId' => 12234])
->orderBy(['addedOn' => SORT_DESC])
->offset(0)->limit(10)
->asArray()
->all();

What's expected?

I have around 10528546 document in that collection and it is taking more then one minute to execute the query

Additional info

Q A
Yii version 2.0.6
Yii MongoDB version 2.1.0
MongoDB server version 3.6
PHP version 7.0
Operating system Ubuntu 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions