primary/secondary index, difference

Started by Daniel Åkerudalmost 25 years ago6 messagesgeneral
Jump to latest
#1Daniel Åkerud
zilch@home.se

What is the difference between a primary and a secondary index?

Is the one created by serial a primary or secondary? why?

Thanks!

---

Daniel Akerud

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Daniel Åkerud (#1)
Re: primary/secondary index, difference

zilch@home.se writes:

What is the difference between a primary and a secondary index?

None, neither exists. All indexes are just indexes.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#3Daniel Åkerud
zilch@home.se
In reply to: Peter Eisentraut (#2)
Re: primary/secondary index, difference

Why I ask is becuase the PostgreSQL documentation mentions "secondary index"
somewhere.

I am sure about it but don't know where.

Daniel Akerud

Show quoted text

What is the difference between a primary and a secondary index?

None, neither exists. All indexes are just indexes.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#4Richard Huxton
dev@archonet.com
In reply to: Daniel Åkerud (#1)
Re: primary/secondary index, difference

From: <zilch@home.se>

Why I ask is becuase the PostgreSQL documentation mentions "secondary

index"

somewhere.

I am sure about it but don't know where.

IIRC the term is used with dbf-style database files.

You might be getting mixed up with primary/secondary keys, which uniquely
refer to a specific row in a table. A primary key would be enforced by using
a UNIQUE index, and serials are commonly used for primary keys where nothing
else is an obvious candidate.

Run a search on the web - there's bound to a primer on relational concepts
like this, or failing that any book on the theory of RDBMS will cover it.

- Richard Huxton

#5Thalis A. Kalfigopoulos
thalis@cs.pitt.edu
In reply to: Peter Eisentraut (#2)
Re: primary/secondary index, difference

I was under the impression that primary index is the same as clustered index i.e. the order in the index matches the physical order the records are stored on disk thus making it better when doing sequential accesses.
I assume that this is exactly the use of the CLUSTER command, to actually make a primary index. T/F?

TIA,
thalis

On Sun, 17 Jun 2001, Peter Eisentraut wrote:

Show quoted text

zilch@home.se writes:

What is the difference between a primary and a secondary index?

None, neither exists. All indexes are just indexes.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

#6Peter Eisentraut
peter_e@gmx.net
In reply to: Thalis A. Kalfigopoulos (#5)
Re: primary/secondary index, difference

Thalis A. Kalfigopoulos writes:

I was under the impression that primary index is the same as clustered index i.e. the order in the index matches the physical order the records are stored on disk thus making it better when doing sequential accesses.
I assume that this is exactly the use of the CLUSTER command, to actually make a primary index. T/F?

No, cluster just orders the table after the index at the time it's called.
Subsequent writes will not obey that order (new rows generally go at the
end).

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter