Re: its really SLOW!!!!! - Mailing list pgsql-novice

From Ron Johnson
Subject Re: its really SLOW!!!!!
Date
Msg-id 1038937112.7312.62.camel@haggis
Whole thread Raw
In response to Re: its really SLOW!!!!!  ("Adler, Stephen" <adler@bnl.gov>)
List pgsql-novice
On Tue, 2002-12-03 at 09:53, Adler, Stephen wrote:
> Paul and Michael,
[snip]
>
> When I went to fill this table, under psql, psql immediately
> gave me errors saying that magent(masterindex) was being
> filled with identical values. So, is there a way of defining
> an index as part of the create table command, or is this
> a mysql extention? After reading the chapter on Indexs in

Is there a pressing need to have it in only 1 statement?

> the users guide, there is no mention of creating an index
> as part of the create table, but rather an index is
> a separate entity used to aid the select command. Am I
> getting keys and indexes mixed up? (I assume they are
> the same thing....)

Pedanticly, a key and an index are radically different:
- A key describes a set of records.
   - with Primary Key, that set must only contain 1 record.
   - Foreign Keys describe sets of 1 or more records that
     also have a Primary Key of the same value in a seperate
     table.
- An index is a method speeding up access to data.  Typical
  types of indexes are:
   - Hashes
   - Trees

As you can see, a UNIQUE index (note that I am not describing
how the index works) is perfect for *implementing* primary keys.
Postgres takes a short cut, and implicitly creates a unique
index when you define a primary key.

"Duplicates allows" indexes are used by Postgres to implement
foreign keys, but, as you see from magent(masterindex), they
are usually used "just" to speed access.

Ron
--
+------------------------------------------------------------+
| Ron Johnson, Jr.     mailto:ron.l.johnson@cox.net          |
| Jefferson, LA  USA   http://members.cox.net/ron.l.johnson  |
|                                                            |
| "they love our milk and honey, but preach about another    |
|  way of living"                                            |
|    Merle Haggard, "The Fighting Side Of Me"                |
+------------------------------------------------------------+


pgsql-novice by date:

Previous
From: "Adler, Stephen"
Date:
Subject: Re: its really SLOW!!!!!
Next
From: Peter & Sarah Childs
Date:
Subject: Re: Starting postmaster in rc.local