Re: Dump CLUSTER in pg_dump

Lists: pgsql-patches
From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Dump CLUSTER in pg_dump
Date: 2003-02-27 06:24:02
Message-ID: 03c301c2de28$d2164c50$6500a8c0@fhp.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Currently, the fact that an index is clustered is not dumped. Unfortunately
the only way of dumping this information is with a cluster statement itself.

One possible improvement would be to sort clustered indexes first and dump
them first, that way the cluster operation does not have to do so much
reindexing.

Example output:

--
-- TOC entry 7 (OID 17078)
-- Name: test_idx; Type: INDEX; Schema: public; Owner: chriskl
--

CREATE INDEX test_idx ON test USING btree (a);

CLUSTER test_idx ON test;

Attachment Content-Type Size
cluster.txt text/plain 3.9 KB

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-02-27 19:44:53
Message-ID: 20030227194453.GA6468@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Thu, Feb 27, 2003 at 02:24:02PM +0800, Christopher Kings-Lynne wrote:
> Currently, the fact that an index is clustered is not dumped. Unfortunately
> the only way of dumping this information is with a cluster statement itself.
>
> One possible improvement would be to sort clustered indexes first and dump
> them first, that way the cluster operation does not have to do so much
> reindexing.

Is this really a good idea? I think the clustering itself should be
done later and manually by the DBA, and the dump should only include a
command to set the indisclustered bit appropiately. What about
inventing a command to only set the bit, maybe

ALTER TABLE <tablename> CLUSTER ON <indexname>

or something like that? I can do that if people thinks it's a good
idea.

(Just returning from vacation and catching up on email).

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El miedo atento y previsor es la madre de la seguridad" (E. Burke)


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Alvaro Herrera" <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: "Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-02-28 02:03:44
Message-ID: 060101c2decd$9faf6850$6500a8c0@fhp.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

> > One possible improvement would be to sort clustered indexes first and
dump
> > them first, that way the cluster operation does not have to do so much
> > reindexing.
>
> Is this really a good idea? I think the clustering itself should be
> done later and manually by the DBA, and the dump should only include a
> command to set the indisclustered bit appropiately. What about
> inventing a command to only set the bit, maybe

No, it's not - but it's the _only_ way of doing it for 7.3.x pg_dump...

> ALTER TABLE <tablename> CLUSTER ON <indexname>
>
> or something like that? I can do that if people thinks it's a good
> idea.

That's exactly what Tom's idea was - I like that particular syntax though.
It's slightly weird I guess to have the two different syntaxes I guess.

I'll add it to my list :)

Chris


From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-03-09 05:01:15
Message-ID: 20030309050115.GB23775@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Fri, Feb 28, 2003 at 10:03:44AM +0800, Christopher Kings-Lynne wrote:

> > ALTER TABLE <tablename> CLUSTER ON <indexname>
> >
> > or something like that? I can do that if people thinks it's a good
> > idea.
>
> That's exactly what Tom's idea was - I like that particular syntax though.
> It's slightly weird I guess to have the two different syntaxes I guess.

Ok, done. The syntax is what I proposed, because no discussion
arised... Let me know what do you think. (Perhaps I got the locking
issues right this time.)

I'm not very SGML literate and haven't been able to build the
documentation in ages, so if there are mistakes in the markup please let
me know.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La vida es para el que se aventura"


From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-03-09 05:37:06
Message-ID: 20030309053706.GA25504@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Sun, Mar 09, 2003 at 01:01:15AM -0400, Alvaro Herrera wrote:

> Ok, done. The syntax is what I proposed, because no discussion
> arised... Let me know what do you think. (Perhaps I got the locking
> issues right this time.)

Lucky I forgot to attach, because there was a mistake. Hopefully this
one is good...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Thou shalt check the array bounds of all strings (indeed, all arrays), for
surely where thou typest "foo" someone someday shall type
"supercalifragilisticexpialidocious" (5th Commandment for C programmers)

Attachment Content-Type Size
alter-table-cluster-on-1.patch text/plain 9.0 KB

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-03-17 05:22:48
Message-ID: 20030317052248.GA22459@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Sun, Mar 09, 2003 at 01:37:06AM -0400, Alvaro Herrera wrote:
> On Sun, Mar 09, 2003 at 01:01:15AM -0400, Alvaro Herrera wrote:
>
> > Ok, done. The syntax is what I proposed, because no discussion
> > arised... Let me know what do you think. (Perhaps I got the locking
> > issues right this time.)
>
> Lucky I forgot to attach, because there was a mistake. Hopefully this
> one is good...

I have received no comments for this patch. Is it going to be accepted,
rejected, commented on?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"¿Qué importan los años? Lo que realmente importa es comprobar que
a fin de cuentas la mejor edad de la vida es estar vivo" (Mafalda)


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Alvaro Herrera" <alvherre(at)dcc(dot)uchile(dot)cl>, "Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-03-17 05:57:06
Message-ID: 04e501c2ec4a$0a726780$6500a8c0@fhp.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

> I have received no comments for this patch. Is it going to be accepted,
> rejected, commented on?

I think Bruce is just taking time getting through them all. If Alvaro's is
accepted, we'll need to change the syntax my 'dump cluster' patch uses...

Chris


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-03-17 21:39:39
Message-ID: 200303172139.h2HLddM09928@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> On Fri, Feb 28, 2003 at 10:03:44AM +0800, Christopher Kings-Lynne wrote:
>
> > > ALTER TABLE <tablename> CLUSTER ON <indexname>
> > >
> > > or something like that? I can do that if people thinks it's a good
> > > idea.
> >
> > That's exactly what Tom's idea was - I like that particular syntax though.
> > It's slightly weird I guess to have the two different syntaxes I guess.
>
> Ok, done. The syntax is what I proposed, because no discussion
> arised... Let me know what do you think. (Perhaps I got the locking
> issues right this time.)
>
> I'm not very SGML literate and haven't been able to build the
> documentation in ages, so if there are mistakes in the markup please let
> me know.
>
> --
> Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
> "La vida es para el que se aventura"
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Dump CLUSTER in pg_dump
Date: 2003-03-20 18:52:38
Message-ID: 200303201852.h2KIqc300217@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> On Fri, Feb 28, 2003 at 10:03:44AM +0800, Christopher Kings-Lynne wrote:
>
> > > ALTER TABLE <tablename> CLUSTER ON <indexname>
> > >
> > > or something like that? I can do that if people thinks it's a good
> > > idea.
> >
> > That's exactly what Tom's idea was - I like that particular syntax though.
> > It's slightly weird I guess to have the two different syntaxes I guess.
>
> Ok, done. The syntax is what I proposed, because no discussion
> arised... Let me know what do you think. (Perhaps I got the locking
> issues right this time.)
>
> I'm not very SGML literate and haven't been able to build the
> documentation in ages, so if there are mistakes in the markup please let
> me know.
>
> --
> Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
> "La vida es para el que se aventura"
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073