Re: Question about Indexes...

Поиск
Список
Период
Сортировка
От Aarni Ruuhimäki
Тема Re: Question about Indexes...
Дата
Msg-id 200401031242.39566.aarni.ruuhimaki@kymi.com
обсуждение исходный текст
Ответ на Question about Indexes...  ("Alan T. Miller" <amiller@hollywood101.com>)
Ответы Re: Question about Indexes...  (Andreas <maps.on@gmx.net>)
Re: Question about Indexes...  (Andreas <maps.on@gmx.net>)
Список 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 | Megative Tmi | KYMI.com
-------------------------------------------------
This is a bugfree broadcast to you from a linux system.
-------------------------------------------------

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Alan T. Miller"
Дата:
Сообщение: Question about Indexes...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Question about Indexes...