-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Oracle relations limit of 1000 #10305
Comments
Should be fixed, thank you for the report. |
That's because of |
I have Table A with 10k procedure records and Table B is a pathology table with 7k rows. Not all procedures will have related pathology. I am using this mainly for generating statistics and I was just testing that the relation worked as I have found Oracle not as easy as MySQL to use, saw this and wondered about it being a bug or my mistake. Is my use case bad? Out of interest then, If you have a large database, is active record not the way to go when accessing the data? |
Yes. It doesn't really matter if it's AR or not. Getting more than 1000 records in a single request is generally not a good idea. It's not fast and memory greedy. |
@samdark @cebe do you think it should be fixed?
Yes, it's greedy, but sometimes a single SQL with 5000 expressions in the |
This is no the point. The point is fetching 1000 records will consume too much memory for PHP script running. What the sense of fixing In general this is not a common use case. Processing of the large amount of data requires more care and attention. |
For me it is also related to #10203, because most time the I've encountered it because I need the count of some entries which are related to another entry. public function getEntries()
{
return $this->hasOne(Entry::className(), ['entryID' => 'entryID'])
->viaTable(EntryInList::tableName(), ['listID' => 'listID']);
} Normally I would do a Join... $model->getEntries()->count(); |
I agree with @samdark and @klimov-paul comments about the memory overflow and that it isn't a good use case. I wrote this initially because I was having trouble with Oracle and wanted to just see if my relations worked. When I saw the error I just assumed it was an oracle not playing nicely with Yii. I have used batch insert previously with Yii2, but have never seen the retrieval piece? Is this is http://www.yiiframework.com/doc-2.0/yii-db-batchqueryresult.html ? |
@jonny7, check this method: http://www.yiiframework.com/doc-2.0/yii-db-query.html#batch%28%29-detail There is also exists usage sample. |
@klimov-paul well, I tend to agree with you. |
Fixed by f6a4f3c |
When trying to access a large models relations like so
I get the error,
ORA-01795: maximum number of expressions in a list is 1000 error
I'm assuming that I haven't done anything wrong or missed something. Looking around, there appears to be a workaround for this: http://stackoverflow.com/a/17844383/895169
Is this something we should look to implement within Yii to help Oracle DBs or am I using Yii incorrectly?
The text was updated successfully, but these errors were encountered: