Thread: primary/secondary index, difference
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
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
Why I ask is becuase the PostgreSQL documentation mentions "secondary index" somewhere. I am sure about it but don't know where. Daniel Akerud > > 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
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
I was under the impression that primary index is the same as clustered index i.e. the order in the index matches the physicalorder 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: > 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 >
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 physicalorder 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