Robin Haswell wrote: > SQLObject > ========= > > * I really like SO. Its inteface is great, I wish I could do joins in > such an easy manner with PHP. However it is just so slow and flaky I > can't handle it any more. Selecting a list of IDs then selecting each > row by ID in turn is just unacceptable. REALLY unacceptable. Even my > project manager has noticed a website is slow because of this.
>From my experience with a Java webapp framework written by a friend of mine, retrieving IDs first, then the objects in a second pass, has been one of the best design decisions he made. I liked the idea so much that we started implementing it in our custom ORM built on Zope, and witnessed a very significant speed improvement. Why this works: 1) the 1st phase (retrieving IDs), even with complex joins and filters, can be really fast, since the database won't have to deal with any real data, only primary keys and indexes. 2) the 2nd phase (retrieving objects) is made really fast too by using aggressive caching. Except for the 1st access to an object, there won't be any more actual database "select", since the object will be retrieved from the cache. A note about the 2nd phase: ideally, it should be done in a single query. For example, if phase one returned a list of (1, 2, 3, 4, 5), and we already have (1, 2, 3) in the cache, the second phase should do a single select with "WHERE id IN (4, 5)". Your comment suggests that SQLObject may do it as 2 distinct selects, which indeed would be suboptimal. Now bear with me: I did not talk about SQLObject in particular. I am still new to it, and I don't know enough about its inner workings to vouch for or against it. All I am saying is: don't blame the idea of splitting IDs retrieval and objects retrieval. IMHO, it's one of the best things since sliced bread! Cheers, -- Yves-Eric --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~----------~----~----~----~------~----~------~--~---

