• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOF being overly helpful.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOF being overly helpful.


  • Subject: Re: EOF being overly helpful.
  • From: Owen McKerrow <email@hidden>
  • Date: Tue, 20 Sep 2005 13:08:36 +1000

Hi Chuck,

I had thought about and tried the batch fault thing, but its grayed out for that relationship. i.e. for the PersonName -> Person relationship I can not set a batch fault value. Any ideas why this would be ?

And I had also added person as pre-fetch path, but it still executes the SQL as below i.e. firing the faults one at a time. Again any ideas why this is ?


On 20/09/2005, at 12:53 PM, Chuck Hill wrote:

Owen,

What you are missing is a batch fetch (fault) on the PersonName -> Person relationship. You don't have one, so it defaults to one at a time. Sloooow. But I gather you have gotten that point. :-) The 167 row fetch is EOF turning the array fault (one object) into an array of faults (many objects). The subsequent one at a time fetches are the faults firing with a lack of a batch faulting setting.

Or, just add a pre-fetching path the fetch spec and fetch them all in one swell foop.

Chuck

On Sep 19, 2005, at 6:30 PM, Owen McKerrow wrote:


Hi All,

I have a table called Person which has a to-many relationship with a table PersonName, which is an optional relationship and Own's Desition is ticked and has a Batch Fault of 5.
The inverse relationship from PersonName to Person is to-one and mandatory. PersonName has its own primary key.
The idea here being a Person's name may change over time and this way I can track when that happens and any records which they entered before the name changed will still have the old name associated with it.
I have a fetch spec in PersonName which I use to get a list names of members which are currently active.
The fetch spec is :
active = 1 and person.accessLevel <> -1 and ( person.type = 2 or person.type = 3 )


Where active indicates its a currently active name, person.accessLevel <> -1 indicates the person is not inactive and person.type 2 & 3 indicates I only want the staff and students.

selectablePersons = (NSMutableArray) EOUtilities.objectsWithFetchSpecificationAndBindings (ec,"PersonName","getActiveMembers",null);

Now this works fine, it retrives all the records I want in 1 hit.
And produces the following SQL

[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT DISTINCT t0.active, t0.creationDate, t0.firstName, t0.initial, t0.lastName, t0.personID, t0._rowid FROM PERSON_NAME t0, PERSON T1 WHERE (t0.active = ? AND T1.accessLevel <> ? AND (T1.type = ? OR T1.type = ?)) AND t0.personID = T1._rowid ORDER BY t0.lastName ASC, t0.firstName ASC" withBindings: 1:1(active), 2:-1 (accessLevel), 3:2(type), 4:3(type)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 167 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction


Not 167 records processed.
However it then grabs all 167 people objects associated with these names, 1 AT A TIME ! Well at least thats what I think its doing. Heres a selection of the SQL that it produces. This is all from the single line of code above.


[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.countryID, t0.email, t0.fileName, t0.filePath, t0.hasFile, t0.institution, t0.onPayroll, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:4(type), 2:1332(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:3(type), 2:1332(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.casualPermant, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:2(type), 2:1332(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> fetch canceled
[2005-09-20 11:20:04 EST] <WorkerThread3> 1 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.countryID, t0.email, t0.fileName, t0.filePath, t0.hasFile, t0.institution, t0.onPayroll, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:4(type), 2:980(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:3(type), 2:980(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.casualPermant, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:2(type), 2:980(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> fetch canceled
[2005-09-20 11:20:04 EST] <WorkerThread3> 1 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.countryID, t0.email, t0.fileName, t0.filePath, t0.hasFile, t0.institution, t0.onPayroll, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:4(type), 2:999(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:3(type), 2:999(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> 0 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> === Begin Internal Transaction
[2005-09-20 11:20:04 EST] <WorkerThread3> evaluateExpression: <com.webobjects.jdbcadaptor.OpenBasePlugIn$OpenBaseExpression: "SELECT t0.academicGeneral, t0.accessLevel, t0.brandNewRecord, t0.building, t0.casualPermant, t0.countryID, t0.email, t0.fax, t0.fileName, t0.filePath, t0.hasFile, t0.onPayroll, t0.phone, t0.room, t0._rowid, t0.staffNumber, t0.title, t0.tobeShown, t0.type, t0.URL, t0.wumpusID FROM PERSON t0 WHERE (t0.type = ? AND t0._rowid = ?)" withBindings: 1:2(type), 2:999(rowID)>
[2005-09-20 11:20:04 EST] <WorkerThread3> fetch canceled
[2005-09-20 11:20:04 EST] <WorkerThread3> 1 row(s) processed
[2005-09-20 11:20:04 EST] <WorkerThread3> === Commit Internal Transaction


Notice how some request produce 0 rows processed and for those that have 1 row processed the fetch is canceled. Suffice to say this is all cause a very large waste of time which means my page takes 4 seconds to load.

I thought perhaps if the to-one relationship between PersonName and Person was optional instead of mandatory it wouldn't try and grab the People records but it still did.

So what am I doing wrong ? I understand EOF is trying to be helpful and grab the People objects for me but this time I don't want it to. In fact Im not even sure what's causing these faults to be fired. If I can't "turn it off" is there any way I can get it to do it all in one go instead of object by object. And why does it cancel the fetch when it actual gets a result ?

As always comments and suggestions welcome.

Owen McKerrow
WebMaster, emlab
http://emlab.uow.edu.au

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

People who prefer typing to pointing then seem to prefer acronyms to save typing :-)
-Denis Stanton, On people using Command Line Interfaces



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net


This email sent to email@hidden



--
Unnamed - an introduction to web applications using WebObjects and Xcode http://www.global-village.net/wointro


Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/ practical_webobjects






Owen McKerrow WebMaster, emlab http://emlab.uow.edu.au

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"As of tomorrow, employees will only be able to access the building using individual security cards. Pictures will be taken next Wednesday employees will receive their cards in two weeks."
- "Dilbert Quotes" Winner, Fred Dales, Microsoft Corp



_______________________________________________ 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
  • Follow-Ups:
    • Re: EOF being overly helpful.
      • From: Chuck Hill <email@hidden>
References: 
 >EOF being overly helpful. (From: Owen McKerrow <email@hidden>)
 >Re: EOF being overly helpful. (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: EOF being overly helpful.
  • Next by Date: Re: EOF being overly helpful.
  • Previous by thread: Re: EOF being overly helpful.
  • Next by thread: Re: EOF being overly helpful.
  • Index(es):
    • Date
    • Thread