Re: ERXFetchSpecificationBatchIterator
Re: ERXFetchSpecificationBatchIterator
- Subject: Re: ERXFetchSpecificationBatchIterator
- From: Johann Werner <email@hidden>
- Date: Wed, 21 Mar 2012 08:47:20 +0100
Hi Ron,
looking at the code of ERXFetchSpecificationBatchIterator the first time you call batchWithIndex all primary keys are fetched so that when you call either batchWitchIndex, batchWithRange or nextBatch the select statement that is sent to the DB will qualify the objects by pk IN (pk1, pk2, ...) that's why you don't see a LIMIT statement.
How big is you Artist table? Which fetch is running too long, the one fetching the pks or that getting the real objects? Is your DB in a good state, do you have an index on your pk column?
jw
Am 21.03.2012 um 08:29 schrieb Ron X:
> hi everybody!
> i have real trouble with ERXFetchSpecificationBatchIterator
>
> EOQualifier qualifier = ERXQ.and(clazz.availabilityQuialifier, qualifierForLetter(letter));
> EOFetchSpecification fs = new EOFetchSpecification(Artist.ENTITY_NAME, qualifier, Artist.NAME.ascs());
> if (pagination != null) {
> ERXFetchSpecificationBatchIterator batchSpec = new ERXFetchSpecificationBatchIterator(fs);
> batchSpec.setBatchSize(10);
> NSArray<Artist> array = batchSpec.batchWithIndex(new Integer(pagination));
> ...
> and than - i have statement running too long exception!
> i see that this batch DO NOT do LIMIT at the end of query!
> so i have 10 elements in array, but the request to DB (MySQL) is incredible!
>
> how can i fix this - to set the real LIMIT at the end of query?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden