X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 07783329E66 for ; Mon, 20 Sep 2004 21:41:58 +0100 (BST) 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 07558-02 for ; Mon, 20 Sep 2004 20:41:51 +0000 (GMT) Received: from web50008.mail.yahoo.com (web50008.mail.yahoo.com [206.190.38.23]) by svr1.postgresql.org (Postfix) with SMTP id 444DE329E80 for ; Mon, 20 Sep 2004 21:41:52 +0100 (BST) Message-ID: <20040920204151.87057.qmail@web50008.mail.yahoo.com> Received: from [69.65.137.210] by web50008.mail.yahoo.com via HTTP; Mon, 20 Sep 2004 15:41:51 CDT Date: Mon, 20 Sep 2004 15:41:51 -0500 (CDT) From: Jaime Casanova Subject: unique constraints on foreign keys To: pgsql-admin@postgresql.org In-Reply-To: <4F86EA9F-011C-11D9-A3D4-000393779D9C@eku.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/176 X-Sequence-Number: 14879 Hi all, I have a reference table that holds all the status used in a system (it's a very little table just 10 or 15 rows). create table status ( cod_status char(2) not null primary key, nam_status text not null ); create table some_other_table ( ... definition of the table ... status char(2) not null references status ); ok. This is the idea if a want to do a reference to the status table i need to create a primary key or a unique index on the status table. Obviously the planner will choose always a seq scan in such a table (it's obvious to you, it's obvious to me, but not to the planner), but the planner will calculate the cost of use the index and will choose the seq. So, there is a way to teach the planner always do a seq on that table and do not ask for use the index? There is a way to not enforce the creation of a primary or unique index on a referenced table? (I mean, a way that not involves the use of a "set" instruction because the odbc not allow such instructions) Thanx in advance, Jaime Casanova _________________________________________________________ Do You Yahoo!? Información de Estados Unidos y América Latina, en Yahoo! Noticias. Visítanos en http://noticias.espanol.yahoo.com