pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Davis <michael.davis@prevuenet.com>
To: pgsql-sql@hub.org
Subject: RE: [SQL] Simple Question??
Date: Mon, 1 Mar 1999 12:05:01 -0600
Message-ID: <93C04F1F5173D211A27900105AA8FCFC14520E@lambic.prevuenet.com> (raw)

I would say yes as long as table_b still references the same sequence as
table_a.  Sequences are stored and maintained separately from the tables
they are used in.  If you drop and recreate a sequence, the starting number
of that sequence will be 1 even though the database using the sequence has
500 records in it.  You can reset the value of the sequence (seq_a) to the
highest value currently stored in the database for the column that seq_a is
being used with.  When I ported my Access97 table to Postgres, I had to set
the value of each sequence I used to match the highest value stored in my
tables.

	-----Original Message-----
	From:	archiver [SMTP:archiver@db.geocrawler.com]
	Sent:	Saturday, February 27, 1999 3:51 PM
	To:	pgsql-sql@hub.org
	Subject:	[SQL] Simple Question??

	Here's a question that maybe you can answer easily...

	If I am using a sequence (seq_a) in table_a

	...then "create table_b as select * from table_a"

	...does table_b start using that sequence (seq_a), starting at the
point
	where table_a left off??

	I have a 1GB table that I want to optimize by reordering it, and I
will want
	the new table to use the same sequence to generate the primary key.
I will
	then drop the original table and rename the table_b to table_a.

	Any clues?

	Tim Perdue
	tim@perdue.net
	



view thread (15+ messages)  latest in thread

Message-ID: <93C04F1F5173D211A27900105AA8FCFC14520E@lambic.prevuenet.com>
Permalink:  ../93C04F1F5173D211A27900105AA8FCFC14520E@lambic.prevuenet.com/
Also on:    postgresql.org/message-id/93C04F1F5173D211A27900105AA8FCFC14520E@lambic.prevuenet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: michael.davis@prevuenet.com, pgsql-sql@hub.org
  Subject: RE: [SQL] Simple Question??
  In-Reply-To: <93C04F1F5173D211A27900105AA8FCFC14520E@lambic.prevuenet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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