Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 44336 invoked from network); 10 Apr 2009 01:20:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Apr 2009 01:20:54 -0000 Received: (qmail 51045 invoked by uid 500); 10 Apr 2009 01:20:53 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 50962 invoked by uid 500); 10 Apr 2009 01:20:53 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 50952 invoked by uid 99); 10 Apr 2009 01:20:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Apr 2009 01:20:53 +0000 X-ASF-Spam-Status: No, hits=-0.6 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [64.18.2.179] (HELO exprod7og113.obsmtp.com) (64.18.2.179) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 10 Apr 2009 01:20:44 +0000 Received: from source ([74.125.46.28]) by exprod7ob113.postini.com ([64.18.6.12]) with SMTP ID DSNKSd6e1q/4W0WUvtXEENGuVIJznH8XCze0@postini.com; Thu, 09 Apr 2009 18:20:24 PDT Received: by yw-out-2324.google.com with SMTP id 3so697662ywj.77 for ; Thu, 09 Apr 2009 18:20:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.13.200 with SMTP id d8mr22761iba.3.1239326422023; Thu, 09 Apr 2009 18:20:22 -0700 (PDT) In-Reply-To: <1f6aacb70904062211n66be620fj9d58fcd568d70739@mail.gmail.com> References: <51162CD8-5237-4703-8C11-D0C12CE4E7CD@SUN.com> <1f6aacb70904062211n66be620fj9d58fcd568d70739@mail.gmail.com> Date: Thu, 9 Apr 2009 21:20:21 -0400 Message-ID: Subject: Re: Multiple join fetches From: Daryl Stultz To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=002215046c47253d5a0467292bc1 X-Virus-Checked: Checked by ClamAV on apache.org --002215046c47253d5a0467292bc1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, Apr 7, 2009 at 1:11 AM, Jay McHugh wrote: > > FetchPlan plan = em.getFetchPlan(); > plan.addField(GrandParent.class, "parents"); > plan.addField(Parent.class, "children"); > > Query query = em.createQuery("select gp from GrandParent as gp"); > > I gave this a good testing and have some interesting (to me) results. My real object model isn't quite like this, it's a little more complicated. What I am doing is retrieving the root object, then traversing the hierarchy and printing it out. If I use all LAZY annotations and no fetch plan (worse case) it takes 3.2 seconds and runs 113 queries (which are interleaved with my print statements). Adding the fetch plan as described above, it takes 1.8 seconds and runs 96 queries (which run before any print statements). Quite a jump in speed but still a lot of queries. If I add the one join fetch to my query it drops to 1.5 seconds and only 24 queries. Honestly I was expecting it to generate one query and run very fast. Do these numbers make sense? -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:daryl@6degrees.com --002215046c47253d5a0467292bc1--