Re: its really SLOW!!!!!
От | Ron Johnson |
---|---|
Тема | Re: its really SLOW!!!!! |
Дата | |
Msg-id | 1038937112.7312.62.camel@haggis обсуждение исходный текст |
Ответ на | Re: its really SLOW!!!!! ("Adler, Stephen" <adler@bnl.gov>) |
Список | 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 по дате отправления: