X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AD6CF534CC for ; Tue, 12 Apr 2005 02:43:20 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23851-09 for ; Tue, 12 Apr 2005 05:43:16 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 050035295A for ; Tue, 12 Apr 2005 02:43:15 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3C5hAmF007311; Tue, 12 Apr 2005 01:43:10 -0400 (EDT) To: "Andrus Moor" Cc: pgsql-sql@postgresql.org Subject: Re: Query runs very slowly in Postgres, but very fast in other DBMS In-reply-to: References: Comments: In-reply-to "Andrus Moor" message dated "Tue, 12 Apr 2005 00:43:10 +0300" Date: Tue, 12 Apr 2005 01:43:10 -0400 Message-ID: <7310.1113284590@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/159 X-Sequence-Number: 21052 "Andrus Moor" writes: > Seq Scan on rid (cost=0.00..28698461.07 rows=32201 width=14) > Filter: (NOT (subplan)) > SubPlan > -> Seq Scan on dok (cost=0.00..864.29 rows=10729 width=14) > Is it possible to speed up this query is Postgres ? Can you switch to int4 or int8 instead of NUMERIC(12)? I think that we don't currently consider NUMERIC hashable, and you really need a hash subplan here. In general NUMERIC is a bad choice if you're hot about performance, anyway. Integers or floats would be probably two orders of magnitude faster. regards, tom lane