Re: seeking: advice on reordering table

From: Brent Wood <b(dot)wood(at)niwa(dot)co(dot)nz>
To: Andrej Ricnik-Bay <andrej(dot)groups(at)gmail(dot)com>
Cc: Jonathan Vanasco <postgres(at)2xlp(dot)com>, pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: seeking: advice on reordering table
Date: 2007-04-12 22:05:42
Message-ID: 461EAD36.2040306@niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrej Ricnik-Bay wrote:
> On 4/12/07, Jonathan Vanasco <postgres(at)2xlp(dot)com> wrote:
>> can anyone suggest a good way to reorder the table ? everything that
>> i can think of involves creating a new table which means I'd have to
>> redo all the constraints .
> The common thing to do is to write your query in such
> a way that what interests you most is put left ...
>
>> // Jonathan Vanasco

Create a clustered index on the attribute you want it ordered by. (I'm
not sure is a clustered index can be a composite, but the docs or
someone else here will let you know :-)

Note that any inserts (or updates on the attr with the clustered index)
will cause the ordering to be broken, in which case you'll need to
re-cluster.

Cheers,

Brent Wood

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Terry Martin 2007-04-12 22:14:01 question
Previous Message dcrespo 2007-04-12 21:40:43 Re: Evaluate only one CASE WHEN in a select