X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 30AF0D1B51F for ; Tue, 23 Mar 2004 15:50:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 21610-07 for ; Tue, 23 Mar 2004 11:50:09 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 6F658D1EC40 for ; Tue, 23 Mar 2004 11:50:04 -0400 (AST) Received: (qmail 23241 invoked by uid 500); 23 Mar 2004 15:53:08 -0000 Date: Tue, 23 Mar 2004 09:53:08 -0600 From: Bruno Wolff III To: Ricardo Vaz Mannrich Cc: Sam Barnett-Cormack , pgsql-admin@postgresql.org Subject: Re: Slow Foreign Key Message-ID: <20040323155308.GB22109@wolff.to> Mail-Followup-To: Ricardo Vaz Mannrich , Sam Barnett-Cormack , pgsql-admin@postgresql.org References: <1079979898.5609.15.camel@paranagua.silcom> <8053.1079988963@sss.pgh.pa.us> <1080041550.2210.1.camel@paranagua.silcom> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1080041550.2210.1.camel@paranagua.silcom> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/299 X-Sequence-Number: 12868 On Tue, Mar 23, 2004 at 08:32:30 -0300, Ricardo Vaz Mannrich wrote: > Both indexed... > > But... When I try EXPLAIN SELECT * FROM detail WHERE master_id = XXXXXX; > PostgreSQL uses seq scan (why?) This has been discussed many times previously and if you want to understand why things are this way search the archives. Things will work better in 7.5. For the time being quoting XXXXX will solve your problem as it will allow the constant to get the same type as master_id.