X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 88AB99FA5BE for ; Thu, 15 Jun 2006 18:03:34 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 49665-09 for ; Thu, 15 Jun 2006 18:03:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 6F6589FA13E for ; Thu, 15 Jun 2006 18:03:29 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1Fqz4z-0003R5-AR for pgsql-sql@postgresql.org; Thu, 15 Jun 2006 17:08:41 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id CE8A84051; Thu, 15 Jun 2006 17:03:22 -0400 (EDT) Date: Thu, 15 Jun 2006 17:03:22 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: SQL Technique Question Message-ID: <20060615210322.GA22035@phlogiston.dyndns.org> References: <20060615205922.4834.qmail@web33301.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060615205922.4834.qmail@web33301.mail.mud.yahoo.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/185 X-Sequence-Number: 25421 On Thu, Jun 15, 2006 at 01:59:22PM -0700, operationsengineer1@yahoo.com wrote: > > is it a good practice to leave this included in the > queries, as is, or should i factor it out somehow? if > i should factor it, how do i do so? If what you're saying is that these additional criteria are redundant, then it's up to you: what do you want to optimise for? If you're protecting against future errors, then the additional criteria might help. If you're protecting against having to write your code to produce a more efficient query, you should weigh the cost and benefit (which benefit includes "easier to debug queries"). There is a probably non-zero cost to the extra joins. A -- Andrew Sullivan | ajs@crankycanuck.ca Unfortunately reformatting the Internet is a little more painful than reformatting your hard drive when it gets out of whack. --Scott Morris