Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 1AA819FBBA2 for ; Tue, 17 Jul 2007 15:47:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 07834-10 for ; Tue, 17 Jul 2007 15:47:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 9124E9FBA0C for ; Tue, 17 Jul 2007 15:47:38 -0300 (ADT) Received: from [192.168.1.50] (or-67-76-146-141.sta.embarqhsd.net [67.76.146.141]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l6HIlbtj006215; Tue, 17 Jul 2007 11:47:38 -0700 Message-ID: <469D0F30.60002@commandprompt.com> Date: Tue, 17 Jul 2007 11:49:20 -0700 From: "Joshua D. Drake" User-Agent: Thunderbird 1.5.0.12 (X11/20070604) MIME-Version: 1.0 To: Jessica Richard CC: pgsql-admin@postgresql.org Subject: Re: Can primary key be dropped and added back in? References: <42645.34466.qm@web56403.mail.re3.yahoo.com> In-Reply-To: <42645.34466.qm@web56403.mail.re3.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.90.3/3688/Tue Jul 17 01:24:08 2007 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 17 Jul 2007 11:47:38 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/183 X-Sequence-Number: 26164 Jessica Richard wrote: > I have a huge table to load (30+M rows). > > Dropping indexes before loading will speed up my process, but I am not > sure about the primary key that was created with the table creation. Is > the Postgres primary key treated like an index? If yes, dropping the > primary key might help my loading as well.... I can drop the primary key by > > alter table tbleName drop constraint pkname_pkey.. it dropped clean this > way. > > But I haven't found the command to put the primary key back (all for > testing now) alter table foo add primary key (baz); Joshua D. Drake > > Is there a command to add the primary key back after loading the data? > > Thanks > > ------------------------------------------------------------------------ > Moody friends. Drama queens. Your life? Nope! - their life, your story. > Play Sims Stories at Yahoo! Games. > -- === The PostgreSQL Company: Command Prompt, Inc. === Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240 Providing the most comprehensive PostgreSQL solutions since 1997 http://www.commandprompt.com/ Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate PostgreSQL Replication: http://www.commandprompt.com/products/