Yii2 - Oracle performance issue when getting one row by a unique field

35 views Asked by At

I'm using Yii2, version 2.0.35, apaoww/yii2-oci8 version **1.0.**0 to connect to Oracle DB

I have a table that stores users, it's about 8 millions rows. This table has an unique index by "phonenumber"

I got a performance issue when trying to get a user by phone number, as below:

$user = User::findOne(['phonenumber' => 'xxxx']);

It takes about 4s, but when I try to select directly in DB, it runs very fast.

Finally, I use Java, it can select very fast. I'm really disappointed with Yii2 and using Java is the best solution currently to solve this problem :(

So, My questions are:

  1. Did you have the same issue with Yii2?
  2. What happened in this case? Is it fixed in the new Yii2 version?
1

There are 1 answers

1
Evgeny On

Is there an index on phonenumber in the User table? If not, then you should fix it and check the speed of the request.