RE: [SQL] Simple Question??

From: Michael Davis <michael(dot)davis(at)prevuenet(dot)com>
To: pgsql-sql(at)hub(dot)org
Subject: RE: [SQL] Simple Question??
Date: 1999-03-01 18:05:01
Message-ID: 93C04F1F5173D211A27900105AA8FCFC14520E@lambic.prevuenet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)db(dot)geocrawler(dot)com]
Sent: Saturday, February 27, 1999 3:51 PM
To: pgsql-sql(at)hub(dot)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(at)perdue(dot)net

Browse pgsql-sql by date

  From Date Subject
Next Message pierre 1999-03-01 22:08:35 6.4.x to 6.5
Previous Message Andru Luvisi 1999-03-01 07:34:58 Re: pgsql-sql-digest V1 #155