Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 79324 invoked from network); 1 Jun 2007 14:29:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jun 2007 14:29:03 -0000 Received: (qmail 57784 invoked by uid 500); 1 Jun 2007 14:29:06 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 57774 invoked by uid 500); 1 Jun 2007 14:29:06 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 57763 invoked by uid 99); 1 Jun 2007 14:29:06 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jun 2007 07:29:06 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [194.213.15.110] (HELO bangkok.pagenic.nl) (194.213.15.110) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 01 Jun 2007 07:29:02 -0700 Received: (qmail 13433 invoked by uid 1002); 1 Jun 2007 14:28:40 -0000 Received: from proxy1.perrit.net (HELO brussels.office.pagelink.nl) (194.213.15.37) by mail.perrit.net with SMTP; 1 Jun 2007 14:28:40 -0000 X-MIMEOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Joins and performance Date: Fri, 1 Jun 2007 16:28:39 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-topic: Joins and performance Thread-index: AcXj6bk3fKUPuU0tEdq7qwBgCBBTdXAX898gAAHVLPAAAWDu4AAAo6sA From: "Robert Kromkamp" To: "Apache Torque Users List" X-Virus-Checked: Checked by ClamAV on apache.org Hi Greg, Thanks for you reply! I've used views before within Torque. But in that case I've problems with inserts/update statements. How do you handle these? Regards, Robert =20 -----Original Message----- From: Greg Monroe [mailto:Greg.Monroe@DukeCE.com]=20 Sent: Friday, June 01, 2007 4:15 PM To: Apache Torque Users List Subject: RE: Joins and performance If this is a frequent/heavily used query, another way to deal with this is to create a view and a matching Torque object. There is a table option that suppresses the SQL generation. You can then just use the Peer/Record object as like it was a normal table. Note you may want to pay close attention to the indices requirements of the underlying table. If commonly used columns in a large join are not index, it can be a BIG performance hit. > -----Original Message----- > From: Vitzethum, Daniel [mailto:Daniel.Vitzethum@gigatronik.com] > Sent: Friday, June 01, 2007 9:40 AM > To: Apache Torque Users List > Subject: AW: Joins and performance >=20 > Hi Robert, >=20 > > If I've 100 companies (which are schools) and 200 buildings, I will=20 > > executes 100 * 200 queries to get all the employees. >=20 > be sure to avoid this... sounds like a killer ;-) >=20 > > In low level SQL > > this query can be combined in one query. Is there a way to handle=20 > > this within Torque? >=20 > In Torque, you can use the Criteria.addJoin() method to link two=20 > tables. >=20 >=20 > Using that feature, you cannot use the Peer.doSelect() method, but=20 > have to use Peer.doSelectVillageRecords(), which will return all=20 > columns of all joined tables in a village Record object, with no big=20 > difference to plain JDBC in handling. If you need or want Torque data=20 > objects, you have to extract them one by one from the result set. >=20 > For a project of us, we wrote a helper class named JoinHelper that=20 > does this business for you AND returns an tree of Torque objects. In=20 > your case, it would return COMPANY objects that can be queried for=20 > their BUILDINGs, which again know their EMPLOYEEs. >=20 > Please search the thread about two years ago in Torque archive and the > discussion about. JoinHelper massively uses reflection, but is tested=20 > quite well and in production. If you have more detailled questions... > you're welcome. >=20 >=20 > Daniel >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > For additional commands, e-mail: torque-user-help@db.apache.org >=20 >=20 Duke CE Privacy Statement Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org