From: | "Sukellusseura Vesikot r(dot)y(dot)" <info(at)vesikot(dot)fi> |
---|---|
To: | "Alan T(dot) Miller" <amiller(at)hollywood101(dot)com> |
Cc: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Question about Indexes... |
Date: | 2004-01-03 10:38:57 |
Message-ID: | 200401031238.57862.info@vesikot.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi,
You can also use a SEQUENCE which is unique and will add a PK constraint to
your field.
Not sure about the date thing because with sequence you would already have a
PK for that row ? A bit confused too ...
e.g.:
CREATE SEQUENCE main_cats_main_cat_id_seq
START 1
INCREMENT 1
MAXVALUE 9223372036854775807
MINVALUE 1
CACHE 1;
CREATE TABLE main_cats (
main_cat_id integer DEFAULT nextval('"main_cats_main_cat_id_seq"'::text)
NOT NULL,
lang_id integer NOT NULL,
main_cat_name text NOT NULL,
mc_order_nro smallint,
main_cat_show boolean NOT NULL,
sub_cats boolean NOT NULL,
last_mod timestamp without time zone
);
BR,
Aarni
On Saturday 03 January 2004 10:27, you wrote:
> If I create a table and assign the column type for what will be the primary
> key the value of "Serial", do I need to explicitly create an index in
> addition?
>
> I was thinking that a Serial, would automatically be a Unique Index
> wouldn't it? I also set that field to the primary key... does that ensure
> an index is created?
>
> Just a little confused...
>
> Also, while I am on the topic, does it do any good to create indexes on a
> timestamp field?
>
> Thanks in advance,
> Alan
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
--
Aarni Ruuhimäki, pj
Sukellusseura Vesikot r.y.
www.vesikot.fi
info(at)vesikot(dot)fi
-------------------------------------------------
Microsoft should change into vacuum cleaner
business where people actually want products
that suck.
-------------------------------------------------
This is a bugfree broadcast to you from a linux system.
-------------------------------------------------
Viestissä mahdollisesti esitetyt mielipiteet
saattavat olla kirjoittajan henkilökohtaisia
näkemyksiä, eivätkä välttämättä edusta
Sukellusseura Vesikot r.y.:n virallista kantaa.
From | Date | Subject | |
---|---|---|---|
Next Message | Aarni Ruuhimäki | 2004-01-03 10:42:39 | Re: Question about Indexes... |
Previous Message | Alan T. Miller | 2004-01-03 08:27:18 | Question about Indexes... |