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 05B0D9FA5C3 for ; Fri, 16 Jun 2006 12:57:26 -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 50556-07 for ; Fri, 16 Jun 2006 12:57:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id 8837F9FA42B for ; Fri, 16 Jun 2006 12:57:22 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1FrGh7-0004RN-00; Fri, 16 Jun 2006 11:57:13 -0400 To: "Aaron Bono" Cc: Joe , pgsql-sql@postgresql.org Subject: Re: Repetitive code References: <44920AA7.7070709@freedomcircle.net> <4492B248.7040406@freedomcircle.net> In-Reply-To: From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 16 Jun 2006 11:57:13 -0400 Message-ID: <87lkrx6qli.fsf@stark.xeocode.com> Lines: 14 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/215 X-Sequence-Number: 25451 "Aaron Bono" writes: > I haven't stared at your query as long as you have so I may have missed > something Likewise I'm perhaps speaking too quickly, but at the risk of making a fool of myself: you should perhaps realize that UNION has to do a fair amount of work to eliminate duplicates. If you know the rows are going to be distinct or if you don't care about duplicates you can save a lot of time by using UNION ALL instead. -- greg