Re: Question about Indexes... - Mailing list pgsql-novice

From Sukellusseura Vesikot r.y.
Subject Re: Question about Indexes...
Date
Msg-id 200401031238.57862.info@vesikot.fi
Whole thread Raw
In response to Question about Indexes...  ("Alan T. Miller" <amiller@hollywood101.com>)
List 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@postgresql.org

--
Aarni Ruuhimäki, pj
Sukellusseura Vesikot r.y.

www.vesikot.fi
info@vesikot.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.

pgsql-novice by date:

Previous
From: rlasjunies@free.fr (Richard LASJUNIES)
Date:
Subject: Re: multiline PL/Python function fails in *.sql
Next
From: rlasjunies@free.fr (Richard LASJUNIES)
Date:
Subject: Re: multiline PL/Python function fails in *.sql