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 D0973D1DB49 for ; Tue, 23 Mar 2004 11:32:43 +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 08075-01 for ; Tue, 23 Mar 2004 07:32:43 -0400 (AST) Received: from servidor.silcom (silcom.com.br [200.138.113.93]) by svr1.postgresql.org (Postfix) with ESMTP id 7C674D1CC93 for ; Tue, 23 Mar 2004 07:32:39 -0400 (AST) Received: from paranagua.silcom (paranagua.silcom [192.168.0.11]) by servidor.silcom (8.11.6p2/linuxconf) with ESMTP id i2NBWUJ31791; Tue, 23 Mar 2004 08:32:31 -0300 Subject: Re: Slow Foreign Key From: Ricardo Vaz Mannrich To: Sam Barnett-Cormack Cc: pgsql-admin@postgresql.org In-Reply-To: References: <1079979898.5609.15.camel@paranagua.silcom> <8053.1079988963@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1 Message-Id: <1080041550.2210.1.camel@paranagua.silcom> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 Date: 23 Mar 2004 08:32:30 -0300 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/295 X-Sequence-Number: 12864 Both indexed... But... When I try EXPLAIN SELECT * FROM detail WHERE master_id = XXXXXX; PostgreSQL uses seq scan (why?) It's very confusing. Em Seg, 2004-03-22 ās 18:34, Sam Barnett-Cormack escreveu: > On Mon, 22 Mar 2004, Tom Lane wrote: > > > Ricardo Vaz Mannrich writes: > > > Is FOREIGN KEY so slow like that? > > > > Not normally. Have you checked that the referencing and referenced > > columns are of the same datatype? Have you done ANALYZE on both tables > > recently? > > Other question that seems, from my experience, to be relevant - are the > referenced/referencing columns indexed? -- Ricardo Vaz Mannrich