Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In PostgreSQL the clustered attribute is held in the metadata of the corresponding index, rather than the relation itself. It is the <code>indisclustered</code> attribute in <a href="http://www.postgresql.org/docs/current/static/catalog-pg-index.html">pg_index</a> catalogue. Note, however, that clustering relations within postgres is a one-time action: even if the attribute is true, updates to the table do not maintain the sorted nature of the data. To date, automatic maintenance of data clustering remains a popular <a href="http://wiki.postgresql.org/wiki/Todo#CLUSTER">TODO</a> item.</p> <p>There is often confusion between <strong>clustered</strong> and <strong>integrated</strong> indexes, particularly since the popular textbooks use conflicting names, and the terminology is different again in the manuals of postgres and SQL server (to name just two). When I talk about an <em>integrated index</em> (also called a <em>main index</em> or <em>primary index</em>) I mean one in which the relation data is contained in the leaves of the index, as opposed an <em>external</em> or <em>secondary</em> index in which the leaves contain index entries that point to the table records. The former type is necessarily always clustered. Unfortunately postgres only supports the latter type. Anyhow, the fact that <em>an integrated (primary) index is always clustered</em> may have given rise to the belief that "a PRIMARY KEY of a table is automatically associated with a clustered index". The two statements sound similar, but are different.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload