X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 345AE30F14B for ; Tue, 17 Jun 2003 18:49:08 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 70210-06 for ; Tue, 17 Jun 2003 15:48:57 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by svr1.postgresql.org (Postfix) with ESMTP id D006130F120 for ; Tue, 17 Jun 2003 15:48:54 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3128771; Tue, 17 Jun 2003 11:49:03 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Jodi Kanter , Postgres SQL List Subject: Re: join syntax Date: Tue, 17 Jun 2003 11:48:09 -0700 User-Agent: KMail/1.4.3 References: <3EEF6170.1040905@virginia.edu> In-Reply-To: <3EEF6170.1040905@virginia.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200306171148.09162.josh@agliodbs.com> X-Archive-Number: 200306/201 X-Sequence-Number: 13959 Jodi, > One of my colleagues has created a database where he has the same field= =20 > name in two tables and uses this field to link his tables rather than=20 > some arbitrary value. For example, he has used "exp_id" in two tables.=20 > When writing his joins he uses a syntax that says something like JOIN ON= =20 > EXP_ID. Can someone tell me what that syntax should be? I am not very=20 > familiar with it since I typically use the syntax where one field is set= =20 > equal to the other. table_a JOIN table_b USING (exp_id) > Personally I prefer not to set databases up this way but cannot seem to= =20 > convince him of this. And yet I am supposed to now help him with his=20 > database and application..=20 That, we can't help you with. Point out to your friend, though, that an explicit JOIN order can often har= m=20 performance when the JOIN order given by the query writer is not ideal. Th= at=20 is, the "FROM table, table, table WHERE expression, expression" syntax give= s=20 the parser a freer hand to choose the fastest execution method. Of course,= =20 on a very small database that typically makes litte difference. --=20 -Josh Berkus Aglio Database Solutions San Francisco