X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 42DF711F6B86 for ; Tue, 18 Apr 2006 19:48:40 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.128 X-Spam-Level: X-Spam-Status: No, score=0.128 required=5 tests=[AWL=0.128] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id VLt-gLNkcv2b for ; Tue, 18 Apr 2006 19:48:32 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 8DED411F6B6D for ; Tue, 18 Apr 2006 19:48:34 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k3IMmWXX019623; Tue, 18 Apr 2006 18:48:32 -0400 (EDT) To: "Jim C. Nasby" cc: Sriram Dandapani , "Pgsql-Performance (E-mail)" Subject: Re: creating of temporary table takes very long In-reply-to: <20060418223410.GL49405@pervasive.com> References: <6992E470F12A444BB787B5C937B9D4DF0406A79C@ca-mail1.cis.local> <20060418223410.GL49405@pervasive.com> Comments: In-reply-to "Jim C. Nasby" message dated "Tue, 18 Apr 2006 17:34:11 -0500" Date: Tue, 18 Apr 2006 18:48:32 -0400 Message-ID: <19622.1145400512@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200604/405 X-Sequence-Number: 18489 "Jim C. Nasby" writes: > You might try rewriting the coalesces into a row comparison... > WHERE row($4, $5, ...) IS NOT DISTINCT FROM row(interface_id, source_id, ...) That would be notationally nicer, but no help performance-wise; I'm fairly sure that IS DISTINCT doesn't get optimized in any fashion whatsoever :-( What might be worth trying is functional indexes on the COALESCE(foo,0) expressions. Or if possible, consider revising your data schema to avoid using NULLs in a way that requires assuming that NULL = NULL. regards, tom lane