pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: adrobj <adrobj@yahoo.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Clustered/covering indexes (or lack thereof :-)
Date: Fri, 16 Nov 2007 19:33:07 +0000
Message-ID: <473DF073.1000503@enterprisedb.com> (raw)
In-Reply-To: <13700848.post@talk.nabble.com>
References: <13700848.post@talk.nabble.com>

adrobj wrote:
> This is probably a FAQ, but I can't find a good answer...
> 
> So - are there common techniques to compensate for the lack of
> clustered/covering indexes in PostgreSQL? To be more specific - here is my
> table (simplified):
> 
> topic_id int
> post_id int
> post_text varchar(1024)
> 
> The most used query is: SELECT post_id, post_text FROM Posts WHERE
> topic_id=XXX. Normally I would have created a clustered index on topic_id,
> and the whole query would take ~1 disk seek.
> 
> What would be the common way to handle this in PostgreSQL, provided that I
> can't afford 1 disk seek per record returned?

You can cluster the table, see 
http://www.postgresql.org/docs/8.2/interactive/sql-cluster.html.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (4+ messages)  latest in thread

Message-ID: <473DF073.1000503@enterprisedb.com>
Permalink:  ../473DF073.1000503@enterprisedb.com/
Also on:    postgresql.org/message-id/473DF073.1000503@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: heikki@enterprisedb.com, adrobj@yahoo.com
  Subject: Re: Clustered/covering indexes (or lack thereof :-)
  In-Reply-To: <473DF073.1000503@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox