pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Can primary key be dropped and added back in?
3+ messages / 3 participants
[nested] [flat]

* Can primary key be dropped and added back in?
@ 2007-07-17 18:44 Jessica Richard <rjessil@yahoo.com>
  2007-07-17 18:49 ` Re: Can primary key be dropped and added back in? Joshua D. Drake <jd@commandprompt.com>
  2007-07-17 19:20 ` Re: Can primary key be dropped and added back in? Igor Neyman <ineyman@perceptron.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Jessica Richard @ 2007-07-17 18:44 UTC (permalink / raw)
  To: pgsql-admin

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)

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. 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Can primary key be dropped and added back in?
  2007-07-17 18:44 Can primary key be dropped and added back in? Jessica Richard <rjessil@yahoo.com>
@ 2007-07-17 18:49 ` Joshua D. Drake <jd@commandprompt.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Joshua D. Drake @ 2007-07-17 18:49 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; +Cc: pgsql-admin

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. 
> <http://us.rd.yahoo.com/evt=48224/*http://sims.yahoo.com/;


-- 

       === 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/




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Can primary key be dropped and added back in?
  2007-07-17 18:44 Can primary key be dropped and added back in? Jessica Richard <rjessil@yahoo.com>
@ 2007-07-17 19:20 ` Igor Neyman <ineyman@perceptron.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Igor Neyman @ 2007-07-17 19:20 UTC (permalink / raw)
  To: Jessica Richard <rjessil@yahoo.com>; pgsql-admin

ALTER TABLE tableName ADD CONSTRAINT pkname_pkey (column1, column2,
...);

________________________________

From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Jessica Richard
Sent: Tuesday, July 17, 2007 2:44 PM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] Can primary key be dropped and added back in?


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)

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.
<http://us.rd.yahoo.com/evt=48224/*http://sims.yahoo.com/; 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-07-17 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-17 18:44 Can primary key be dropped and added back in? Jessica Richard <rjessil@yahoo.com>
2007-07-17 18:49 ` Joshua D. Drake <jd@commandprompt.com>
2007-07-17 19:20 ` Igor Neyman <ineyman@perceptron.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox