Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nishanthrk opened this issue Oct 12, 2018 · 2 comments
Labels
status:to be verified Needs to be reproduced and validated.

Comments

@nishanthrk
Copy link

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
@cebe
Copy link
Member

cebe commented Oct 12, 2018

is it faster if you try the same query without Yii?

@yiisoft yiisoft deleted a comment from yii-bot Oct 12, 2018
@nishanthrk
Copy link
Author

When i executve the same query in mongo console or robo 3t it took only approximate 10 sec

Query:
db.getCollection('log').find({'userId': 23453})

@bizley bizley added the status:to be verified Needs to be reproduced and validated. label Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated.
Projects
None yet
Development

No branches or pull requests

4 participants