Re: Proposal : REINDEX SCHEMA

Lists: pgsql-hackers
From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposal : REINDEX SCHEMA
Date: 2014-10-12 13:58:24
Message-ID: CAD21AoCiWv1YsF6de9bUE0MDCmfOtkW-w=qpSWM6Ea-7nuaiOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

Attached WIP patch adds new syntax REINEX SCHEMA which does reindexing
all table of specified schema.
There are syntax dose reindexing specified index, per table and per database,
but we can not do reindexing per schema for now.
So we must use reindexdb command if we want to do.
This new syntax supports it as SQL command.
This use similar logic as REINDEX DATABASE, but we can use it in
transaction block.
Here is some example,

-- Table information
[postgres][5432](1)=# \d n1.hoge
Table "n1.hoge"
Column | Type | Modifiers
--------+---------+-----------
col | integer | not null
Indexes:
"hoge_pkey" PRIMARY KEY, btree (col)

[postgres][5432](1)=# \d n2.hoge
Table "n2.hoge"
Column | Type | Modifiers
--------+---------+-----------
col | integer |

[postgres][5432](1)=# \d n3.hoge
Did not find any relation named "n3.hoge".

-- Do reindexing
[postgres][5432](1)=# reindex schema n1;
NOTICE: table "n1.hoge" was reindexed
REINDEX
[postgres][5432](1)=# reindex schema n2;
REINDEX
[postgres][5432](1)=# reindex schema n3;
NOTICE: schema"n3" does not hava any table
REINDEX

Please review and comment.

Regards,

-------
Sawada Masahiko

Attachment Content-Type Size
reindex_schema_v1.patch application/octet-stream 4.9 KB

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-12 15:44:46
Message-ID: 20141012154446.GU7043@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sawada Masahiko wrote:
> Hi all,
>
> Attached WIP patch adds new syntax REINEX SCHEMA which does reindexing
> all table of specified schema.
> There are syntax dose reindexing specified index, per table and per database,
> but we can not do reindexing per schema for now.

It seems doubtful that there really is much use for this feature, but if
there is, I think a better syntax precedent is the new ALTER TABLE ALL
IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
Something like REINDEX TABLE ALL IN SCHEMA perhaps.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-12 17:27:25
Message-ID: 20141012172725.GX28859@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
> Sawada Masahiko wrote:
> > Attached WIP patch adds new syntax REINEX SCHEMA which does reindexing
> > all table of specified schema.
> > There are syntax dose reindexing specified index, per table and per database,
> > but we can not do reindexing per schema for now.
>
> It seems doubtful that there really is much use for this feature, but if
> there is, I think a better syntax precedent is the new ALTER TABLE ALL
> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
> Something like REINDEX TABLE ALL IN SCHEMA perhaps.

Yeah, I tend to agree that we should be looking at the 'ALL IN
TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
consistent. This might be an alternative for the vacuum / analyze /
reindex database commands also..

Thanks,

Stephen


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-13 04:25:47
Message-ID: CAFcNs+pM3hYCMUgX4rvw7dZdBT0V=h_zQa7pn0HNKSAN6_tPdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Oct 12, 2014 at 2:27 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>
> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
> > Sawada Masahiko wrote:
> > > Attached WIP patch adds new syntax REINEX SCHEMA which does reindexing
> > > all table of specified schema.
> > > There are syntax dose reindexing specified index, per table and per
database,
> > > but we can not do reindexing per schema for now.
> >
> > It seems doubtful that there really is much use for this feature, but if
> > there is, I think a better syntax precedent is the new ALTER TABLE ALL
> > IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
> > Something like REINDEX TABLE ALL IN SCHEMA perhaps.
>
> Yeah, I tend to agree that we should be looking at the 'ALL IN
> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
> consistent. This might be an alternative for the vacuum / analyze /
> reindex database commands also..
>

Some review:

1) +1 to "REINDEX ALL IN SCHEMA name"

2) IMHO the logic should be exactly the same as REINDEX DATABASE, including
the transaction control. Imagine a schema with a lot of tables, you can
lead to a deadlock using just one transaction block.

3) The patch was applied to master and compile without warnings

4) Typo (... does not have any table)

+ if (!reindex_schema(heapOid))
+ ereport(NOTICE,
+ (errmsg("schema\"%s\" does not hava any table",
+ schema->relname)));

5) Missing of regression tests, please add it to
src/test/regress/sql/create_index.sql

6) You need to add psql complete tabs

7) I think we can add "-S / --schema" option do reindexdb in this patch
too. What do you think?

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: fabriziomello(at)gmail(dot)com
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-13 08:39:45
Message-ID: CAD21AoBkcWjzbMew=dfKA6RwCRYcjkvZ7QUyntegi+gPoA2QRQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 13, 2014 at 1:25 PM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> On Sun, Oct 12, 2014 at 2:27 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>>
>> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
>> > Sawada Masahiko wrote:
>> > > Attached WIP patch adds new syntax REINEX SCHEMA which does reindexing
>> > > all table of specified schema.
>> > > There are syntax dose reindexing specified index, per table and per
>> > > database,
>> > > but we can not do reindexing per schema for now.
>> >
>> > It seems doubtful that there really is much use for this feature, but if
>> > there is, I think a better syntax precedent is the new ALTER TABLE ALL
>> > IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
>> > Something like REINDEX TABLE ALL IN SCHEMA perhaps.
>>
>> Yeah, I tend to agree that we should be looking at the 'ALL IN
>> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
>> consistent. This might be an alternative for the vacuum / analyze /
>> reindex database commands also..
>>
>
> Some review:
>
> 1) +1 to "REINDEX ALL IN SCHEMA name"
>

Thank you for comment and reviewing!

I agree with this.
I will change syntax to above like that.

>
> 2) IMHO the logic should be exactly the same as REINDEX DATABASE, including
> the transaction control. Imagine a schema with a lot of tables, you can lead
> to a deadlock using just one transaction block.
>

Yep, it should be same as REINDEX DATABASE.
IMO, we can put them into one function if they use exactly same logic.
Thought?

>
> 3) The patch was applied to master and compile without warnings
>
>
> 4) Typo (... does not have any table)
>
> + if (!reindex_schema(heapOid))
> + ereport(NOTICE,
> + (errmsg("schema\"%s\" does not hava any table",
> + schema->relname)));
>

Thanks! I will correct typo.

>
> 5) Missing of regression tests, please add it to
> src/test/regress/sql/create_index.sql
>
> 6) You need to add psql complete tabs
>

Next version patch, that I will submit, will have 5), 6) things you pointed.

> 7) I think we can add "-S / --schema" option do reindexdb in this patch too.
> What do you think?
>

+1 to add "-S / --schema" option
I was misunderstanding about that.
I will make the patch which adds this option as separate patch.

--
Regards,

-------
Sawada Masahiko


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-13 13:23:13
Message-ID: CAFcNs+rUHPM78eMAUfzvGfRTuLqZsPVcZuAF=7VdtOLfmzPCUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 13, 2014 at 5:39 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
wrote:
>
> On Mon, Oct 13, 2014 at 1:25 PM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
> > On Sun, Oct 12, 2014 at 2:27 PM, Stephen Frost <sfrost(at)snowman(dot)net>
wrote:
> >>
> >> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
> >> > Sawada Masahiko wrote:
> >> > > Attached WIP patch adds new syntax REINEX SCHEMA which does
reindexing
> >> > > all table of specified schema.
> >> > > There are syntax dose reindexing specified index, per table and per
> >> > > database,
> >> > > but we can not do reindexing per schema for now.
> >> >
> >> > It seems doubtful that there really is much use for this feature,
but if
> >> > there is, I think a better syntax precedent is the new ALTER TABLE
ALL
> >> > IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
> >> > Something like REINDEX TABLE ALL IN SCHEMA perhaps.
> >>
> >> Yeah, I tend to agree that we should be looking at the 'ALL IN
> >> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
> >> consistent. This might be an alternative for the vacuum / analyze /
> >> reindex database commands also..
> >>
> >
> > Some review:
> >
> > 1) +1 to "REINDEX ALL IN SCHEMA name"
> >
>
> Thank you for comment and reviewing!
>
> I agree with this.
> I will change syntax to above like that.
>
> >
> > 2) IMHO the logic should be exactly the same as REINDEX DATABASE,
including
> > the transaction control. Imagine a schema with a lot of tables, you can
lead
> > to a deadlock using just one transaction block.
> >
>
> Yep, it should be same as REINDEX DATABASE.
> IMO, we can put them into one function if they use exactly same logic.
> Thought?
>
> >
> > 3) The patch was applied to master and compile without warnings
> >
> >
> > 4) Typo (... does not have any table)
> >
> > + if (!reindex_schema(heapOid))
> > + ereport(NOTICE,
> > + (errmsg("schema\"%s\" does not hava any table",
> > + schema->relname)));
> >
>
> Thanks! I will correct typo.
>
> >
> > 5) Missing of regression tests, please add it to
> > src/test/regress/sql/create_index.sql
> >
> > 6) You need to add psql complete tabs
> >
>
> Next version patch, that I will submit, will have 5), 6) things you
pointed.
>
> > 7) I think we can add "-S / --schema" option do reindexdb in this patch
too.
> > What do you think?
> >
>
> +1 to add "-S / --schema" option
> I was misunderstanding about that.
> I will make the patch which adds this option as separate patch.
>

I registered to the next commitfest [1] and put myself as reviewer.

Regards,

[1] https://commitfest.postgresql.org/action/patch_view?id=1598

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-13 14:16:55
Message-ID: CA+TgmoZs6ein29YaD_2Sw7=JMY8CBiFtEJzxmazsOp31=yuAQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
>> Sawada Masahiko wrote:
>> > Attached WIP patch adds new syntax REINEX SCHEMA which does reindexing
>> > all table of specified schema.
>> > There are syntax dose reindexing specified index, per table and per database,
>> > but we can not do reindexing per schema for now.
>>
>> It seems doubtful that there really is much use for this feature, but if
>> there is, I think a better syntax precedent is the new ALTER TABLE ALL
>> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
>
> Yeah, I tend to agree that we should be looking at the 'ALL IN
> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
> consistent. This might be an alternative for the vacuum / analyze /
> reindex database commands also..

Urgh. I don't have a problem with that syntax in general, but it
clashes pretty awfully with what we're already doing for REINDEX
otherwise.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-15 14:41:12
Message-ID: CAD21AoBmmLc8mcV+9D9nPj6EXQ4X_LyAPpPVWwH6jmy+VEQFew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 13, 2014 at 11:16 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
>>> Sawada Masahiko wrote:
>>> > Attached WIP patch adds new syntax REINEX SCHEMA which does reindexing
>>> > all table of specified schema.
>>> > There are syntax dose reindexing specified index, per table and per database,
>>> > but we can not do reindexing per schema for now.
>>>
>>> It seems doubtful that there really is much use for this feature, but if
>>> there is, I think a better syntax precedent is the new ALTER TABLE ALL
>>> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
>>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
>>
>> Yeah, I tend to agree that we should be looking at the 'ALL IN
>> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
>> consistent. This might be an alternative for the vacuum / analyze /
>> reindex database commands also..
>
> Urgh. I don't have a problem with that syntax in general, but it
> clashes pretty awfully with what we're already doing for REINDEX
> otherwise.
>

Attached patches are latest version patch.
I changed syntax to REINDEX ALL IN SCHEMA, but I felt a sense of
discomfort a little
as Robert mentioned.

Anyway, you can apply these patches in numerical order,
can use REINDEX ALL IN SCHEMA feature and "-S/--schema" option in reindexdb.

000_reindex_all_in_schema_v2.patch : It contains REINDEX ALL IN SCHEMA feature
001_Add_schema_option_to_reindexdb_v1.patch : It contains reindexdb
"-S/--schema" supporting

Please review and comments.

Regards,

-------
Sawada Masahiko

Attachment Content-Type Size
000_reindex_all_in_schema_v2.patch application/octet-stream 11.6 KB
001_Add_schema_option_to_reindexdb_v1.patch application/octet-stream 4.7 KB

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-16 19:32:58
Message-ID: CAFcNs+q8DB9YpFwZ8GiY1i7TUuLgapRKCRisiGtFTemytA3=jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Oct 15, 2014 at 11:41 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
wrote:
>
> On Mon, Oct 13, 2014 at 11:16 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
wrote:
> > On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <sfrost(at)snowman(dot)net>
wrote:
> >> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
> >>> Sawada Masahiko wrote:
> >>> > Attached WIP patch adds new syntax REINEX SCHEMA which does
reindexing
> >>> > all table of specified schema.
> >>> > There are syntax dose reindexing specified index, per table and per
database,
> >>> > but we can not do reindexing per schema for now.
> >>>
> >>> It seems doubtful that there really is much use for this feature, but
if
> >>> there is, I think a better syntax precedent is the new ALTER TABLE ALL
> >>> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
> >>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
> >>
> >> Yeah, I tend to agree that we should be looking at the 'ALL IN
> >> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
> >> consistent. This might be an alternative for the vacuum / analyze /
> >> reindex database commands also..
> >
> > Urgh. I don't have a problem with that syntax in general, but it
> > clashes pretty awfully with what we're already doing for REINDEX
> > otherwise.
> >
>
> Attached patches are latest version patch.

Ok.

> I changed syntax to REINDEX ALL IN SCHEMA, but I felt a sense of
> discomfort a little
> as Robert mentioned.
>

I understood, but the real problem will in a near future when the features
will be pushed... :-)

They are separated features, but maybe we can join this features to a one
future commit... it's just an idea.

> Anyway, you can apply these patches in numerical order,
> can use REINDEX ALL IN SCHEMA feature and "-S/--schema" option in
reindexdb.
>
> 000_reindex_all_in_schema_v2.patch : It contains REINDEX ALL IN SCHEMA
feature

1) Compile without warnings

2) IMHO you can add more test cases to better code coverage:

* reindex a schema that doesn't exists
* try to run "reindex all in schema" inside a transaction block

3) Isn't enough just?

bool do_database = (kind == OBJECT_DATABASE);

... instead of...

+ bool do_database = (kind == OBJECT_DATABASE) ? true : false;

4) IMHO you can add other Assert to check valid relkinds, like:

Assert(kind == OBJECT_DATABASE || kind == OBJECT_SCHEMA);

5) I think is more legible:

/* Get OID of object for result */
if (do_database)
objectOid = MyDatabaseId
else
objectOid = get_namespace_oid(objectName, false);

... insead of ...

+ /* Get OID of object for result */
+ objectOid = (do_database) ? MyDatabaseId :
get_namespace_oid(objectName, false);

> 001_Add_schema_option_to_reindexdb_v1.patch : It contains reindexdb
> "-S/--schema" supporting
>

The code itself is good for me, but IMHO you can add test cases
to src/bin/scripts/t/090_reindexdb.pl

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-19 15:02:47
Message-ID: CAD21AoBfOira-vaP5Bi-g_2M9uNS9y7gkm3Mucbes3k=oyp9YQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Oct 17, 2014 at 4:32 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> On Wed, Oct 15, 2014 at 11:41 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
> wrote:
>>
>> On Mon, Oct 13, 2014 at 11:16 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
>> wrote:
>> > On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <sfrost(at)snowman(dot)net>
>> > wrote:
>> >> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
>> >>> Sawada Masahiko wrote:
>> >>> > Attached WIP patch adds new syntax REINEX SCHEMA which does
>> >>> > reindexing
>> >>> > all table of specified schema.
>> >>> > There are syntax dose reindexing specified index, per table and per
>> >>> > database,
>> >>> > but we can not do reindexing per schema for now.
>> >>>
>> >>> It seems doubtful that there really is much use for this feature, but
>> >>> if
>> >>> there is, I think a better syntax precedent is the new ALTER TABLE ALL
>> >>> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
>> >>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
>> >>
>> >> Yeah, I tend to agree that we should be looking at the 'ALL IN
>> >> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
>> >> consistent. This might be an alternative for the vacuum / analyze /
>> >> reindex database commands also..
>> >
>> > Urgh. I don't have a problem with that syntax in general, but it
>> > clashes pretty awfully with what we're already doing for REINDEX
>> > otherwise.
>> >
>>
>> Attached patches are latest version patch.
>
> Ok.
>
>
>> I changed syntax to REINDEX ALL IN SCHEMA, but I felt a sense of
>> discomfort a little
>> as Robert mentioned.
>>
>
> I understood, but the real problem will in a near future when the features
> will be pushed... :-)
>
> They are separated features, but maybe we can join this features to a one
> future commit... it's just an idea.
>
>
>> Anyway, you can apply these patches in numerical order,
>> can use REINDEX ALL IN SCHEMA feature and "-S/--schema" option in
>> reindexdb.
>>
>> 000_reindex_all_in_schema_v2.patch : It contains REINDEX ALL IN SCHEMA
>> feature
>
> 1) Compile without warnings
>
>
> 2) IMHO you can add more test cases to better code coverage:
>
> * reindex a schema that doesn't exists
> * try to run "reindex all in schema" inside a transaction block
>
>
> 3) Isn't enough just?
>
> bool do_database = (kind == OBJECT_DATABASE);
>
> ... instead of...
>
> + bool do_database = (kind == OBJECT_DATABASE) ? true : false;
>
>
> 4) IMHO you can add other Assert to check valid relkinds, like:
>
> Assert(kind == OBJECT_DATABASE || kind == OBJECT_SCHEMA);
>
>
> 5) I think is more legible:
>
> /* Get OID of object for result */
> if (do_database)
> objectOid = MyDatabaseId
> else
> objectOid = get_namespace_oid(objectName, false);
>
> ... insead of ...
>
> + /* Get OID of object for result */
> + objectOid = (do_database) ? MyDatabaseId : get_namespace_oid(objectName,
> false);
>
>
>
>> 001_Add_schema_option_to_reindexdb_v1.patch : It contains reindexdb
>> "-S/--schema" supporting
>>
>
> The code itself is good for me, but IMHO you can add test cases to
> src/bin/scripts/t/090_reindexdb.pl
>

Thank you for reviewing.
I agree 2) - 5).
Attached patch is latest version patch I modified above.
Also, I noticed I had forgotten to add the patch regarding document of
reindexdb.

Please review and comments.

Regards,

-------
Sawada Masahiko

Attachment Content-Type Size
000_reindex_all_in_schema_v3.patch application/octet-stream 11.8 KB
001_Add_schema_option_to_reindexdb_v2.patch application/octet-stream 6.6 KB

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-20 00:37:38
Message-ID: CAFcNs+oTkS+HWEd8An=Ry-qOcPyHPG_n-gr-3LRjRwktvjf1Rg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Oct 19, 2014 at 1:02 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
wrote:
>
> On Fri, Oct 17, 2014 at 4:32 AM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
> > On Wed, Oct 15, 2014 at 11:41 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com
>
> > wrote:
> >>
> >> On Mon, Oct 13, 2014 at 11:16 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
> >> wrote:
> >> > On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <sfrost(at)snowman(dot)net>
> >> > wrote:
> >> >> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
> >> >>> Sawada Masahiko wrote:
> >> >>> > Attached WIP patch adds new syntax REINEX SCHEMA which does
> >> >>> > reindexing
> >> >>> > all table of specified schema.
> >> >>> > There are syntax dose reindexing specified index, per table and
per
> >> >>> > database,
> >> >>> > but we can not do reindexing per schema for now.
> >> >>>
> >> >>> It seems doubtful that there really is much use for this feature,
but
> >> >>> if
> >> >>> there is, I think a better syntax precedent is the new ALTER TABLE
ALL
> >> >>> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
> >> >>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
> >> >>
> >> >> Yeah, I tend to agree that we should be looking at the 'ALL IN
> >> >> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
> >> >> consistent. This might be an alternative for the vacuum / analyze /
> >> >> reindex database commands also..
> >> >
> >> > Urgh. I don't have a problem with that syntax in general, but it
> >> > clashes pretty awfully with what we're already doing for REINDEX
> >> > otherwise.
> >> >
> >>
> >> Attached patches are latest version patch.
> >
> > Ok.
> >
> >
> >> I changed syntax to REINDEX ALL IN SCHEMA, but I felt a sense of
> >> discomfort a little
> >> as Robert mentioned.
> >>
> >
> > I understood, but the real problem will in a near future when the
features
> > will be pushed... :-)
> >
> > They are separated features, but maybe we can join this features to a
one
> > future commit... it's just an idea.
> >
> >
> >> Anyway, you can apply these patches in numerical order,
> >> can use REINDEX ALL IN SCHEMA feature and "-S/--schema" option in
> >> reindexdb.
> >>
> >> 000_reindex_all_in_schema_v2.patch : It contains REINDEX ALL IN SCHEMA
> >> feature
> >
> > 1) Compile without warnings
> >
> >
> > 2) IMHO you can add more test cases to better code coverage:
> >
> > * reindex a schema that doesn't exists
> > * try to run "reindex all in schema" inside a transaction block
> >
> >
> > 3) Isn't enough just?
> >
> > bool do_database = (kind == OBJECT_DATABASE);
> >
> > ... instead of...
> >
> > + bool do_database = (kind == OBJECT_DATABASE) ? true : false;
> >
> >
> > 4) IMHO you can add other Assert to check valid relkinds, like:
> >
> > Assert(kind == OBJECT_DATABASE || kind == OBJECT_SCHEMA);
> >
> >
> > 5) I think is more legible:
> >
> > /* Get OID of object for result */
> > if (do_database)
> > objectOid = MyDatabaseId
> > else
> > objectOid = get_namespace_oid(objectName, false);
> >
> > ... insead of ...
> >
> > + /* Get OID of object for result */
> > + objectOid = (do_database) ? MyDatabaseId :
get_namespace_oid(objectName,
> > false);
> >
> >
> >
> >> 001_Add_schema_option_to_reindexdb_v1.patch : It contains reindexdb
> >> "-S/--schema" supporting
> >>
> >
> > The code itself is good for me, but IMHO you can add test cases to
> > src/bin/scripts/t/090_reindexdb.pl
> >
>
> Thank you for reviewing.

You're welcome!

> I agree 2) - 5).

:-)

> Attached patch is latest version patch I modified above.

All is fine to me now... all work as expected and no compiler warnings.

There are just a little fix to do in src/bin/scripts/t/090_reindexdb.pl

-use Test::More tests => 7;
+use Test::More tests => 8;

Because you added a new testcase to suittest, so you need to increase the
test count at beginning of the file.

> Also, I noticed I had forgotten to add the patch regarding document of
> reindexdb.
>

Yeah... I forgot it too... :-) I'm not a native speaker but IMHO the docs
is fine.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-20 00:41:16
Message-ID: CAFcNs+r1MtBLwt-FhfC+YtrpgPUb8eWhbMmHRuCpx2GRW7pd0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Oct 19, 2014 at 10:37 PM, Fabrízio de Royes Mello <
fabriziomello(at)gmail(dot)com> wrote:
>
>
> On Sun, Oct 19, 2014 at 1:02 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
wrote:
> >
> > On Fri, Oct 17, 2014 at 4:32 AM, Fabrízio de Royes Mello
> > <fabriziomello(at)gmail(dot)com> wrote:
> > > On Wed, Oct 15, 2014 at 11:41 AM, Sawada Masahiko <
sawada(dot)mshk(at)gmail(dot)com>
> > > wrote:
> > >>
> > >> On Mon, Oct 13, 2014 at 11:16 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
> > >> wrote:
> > >> > On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <sfrost(at)snowman(dot)net>
> > >> > wrote:
> > >> >> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
> > >> >>> Sawada Masahiko wrote:
> > >> >>> > Attached WIP patch adds new syntax REINEX SCHEMA which does
> > >> >>> > reindexing
> > >> >>> > all table of specified schema.
> > >> >>> > There are syntax dose reindexing specified index, per table
and per
> > >> >>> > database,
> > >> >>> > but we can not do reindexing per schema for now.
> > >> >>>
> > >> >>> It seems doubtful that there really is much use for this
feature, but
> > >> >>> if
> > >> >>> there is, I think a better syntax precedent is the new ALTER
TABLE ALL
> > >> >>> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
> > >> >>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
> > >> >>
> > >> >> Yeah, I tend to agree that we should be looking at the 'ALL IN
> > >> >> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
> > >> >> consistent. This might be an alternative for the vacuum /
analyze /
> > >> >> reindex database commands also..
> > >> >
> > >> > Urgh. I don't have a problem with that syntax in general, but it
> > >> > clashes pretty awfully with what we're already doing for REINDEX
> > >> > otherwise.
> > >> >
> > >>
> > >> Attached patches are latest version patch.
> > >
> > > Ok.
> > >
> > >
> > >> I changed syntax to REINDEX ALL IN SCHEMA, but I felt a sense of
> > >> discomfort a little
> > >> as Robert mentioned.
> > >>
> > >
> > > I understood, but the real problem will in a near future when the
features
> > > will be pushed... :-)
> > >
> > > They are separated features, but maybe we can join this features to a
one
> > > future commit... it's just an idea.
> > >
> > >
> > >> Anyway, you can apply these patches in numerical order,
> > >> can use REINDEX ALL IN SCHEMA feature and "-S/--schema" option in
> > >> reindexdb.
> > >>
> > >> 000_reindex_all_in_schema_v2.patch : It contains REINDEX ALL IN
SCHEMA
> > >> feature
> > >
> > > 1) Compile without warnings
> > >
> > >
> > > 2) IMHO you can add more test cases to better code coverage:
> > >
> > > * reindex a schema that doesn't exists
> > > * try to run "reindex all in schema" inside a transaction block
> > >
> > >
> > > 3) Isn't enough just?
> > >
> > > bool do_database = (kind == OBJECT_DATABASE);
> > >
> > > ... instead of...
> > >
> > > + bool do_database = (kind == OBJECT_DATABASE) ? true : false;
> > >
> > >
> > > 4) IMHO you can add other Assert to check valid relkinds, like:
> > >
> > > Assert(kind == OBJECT_DATABASE || kind == OBJECT_SCHEMA);
> > >
> > >
> > > 5) I think is more legible:
> > >
> > > /* Get OID of object for result */
> > > if (do_database)
> > > objectOid = MyDatabaseId
> > > else
> > > objectOid = get_namespace_oid(objectName, false);
> > >
> > > ... insead of ...
> > >
> > > + /* Get OID of object for result */
> > > + objectOid = (do_database) ? MyDatabaseId :
get_namespace_oid(objectName,
> > > false);
> > >
> > >
> > >
> > >> 001_Add_schema_option_to_reindexdb_v1.patch : It contains reindexdb
> > >> "-S/--schema" supporting
> > >>
> > >
> > > The code itself is good for me, but IMHO you can add test cases to
> > > src/bin/scripts/t/090_reindexdb.pl
> > >
> >
> > Thank you for reviewing.
>
> You're welcome!
>
>
> > I agree 2) - 5).
>
> :-)
>
>
> > Attached patch is latest version patch I modified above.
>
> All is fine to me now... all work as expected and no compiler warnings.
>
> There are just a little fix to do in src/bin/scripts/t/090_reindexdb.pl
>
> -use Test::More tests => 7;
> +use Test::More tests => 8;
>
> Because you added a new testcase to suittest, so you need to increase the
test count at beginning of the file.
>

Patch attached. Now the regress run without errors.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

Attachment Content-Type Size
001_Add_schema_option_to_reindexdb_v3.patch text/x-patch 6.8 KB

From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-20 13:24:53
Message-ID: CAD21AoD60DLDm2ZD_oN3nEAKVTkAn+b5K_BUq1q7Qic7N-0_ng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 20, 2014 at 9:41 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
>
>
> On Sun, Oct 19, 2014 at 10:37 PM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
>>
>>
>> On Sun, Oct 19, 2014 at 1:02 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
>> wrote:
>> >
>> > On Fri, Oct 17, 2014 at 4:32 AM, Fabrízio de Royes Mello
>> > <fabriziomello(at)gmail(dot)com> wrote:
>> > > On Wed, Oct 15, 2014 at 11:41 AM, Sawada Masahiko
>> > > <sawada(dot)mshk(at)gmail(dot)com>
>> > > wrote:
>> > >>
>> > >> On Mon, Oct 13, 2014 at 11:16 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
>> > >> wrote:
>> > >> > On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <sfrost(at)snowman(dot)net>
>> > >> > wrote:
>> > >> >> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
>> > >> >>> Sawada Masahiko wrote:
>> > >> >>> > Attached WIP patch adds new syntax REINEX SCHEMA which does
>> > >> >>> > reindexing
>> > >> >>> > all table of specified schema.
>> > >> >>> > There are syntax dose reindexing specified index, per table and
>> > >> >>> > per
>> > >> >>> > database,
>> > >> >>> > but we can not do reindexing per schema for now.
>> > >> >>>
>> > >> >>> It seems doubtful that there really is much use for this feature,
>> > >> >>> but
>> > >> >>> if
>> > >> >>> there is, I think a better syntax precedent is the new ALTER
>> > >> >>> TABLE ALL
>> > >> >>> IN TABLESPACE thingy, rather than your proposed REINDEX SCHEMA.
>> > >> >>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
>> > >> >>
>> > >> >> Yeah, I tend to agree that we should be looking at the 'ALL IN
>> > >> >> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
>> > >> >> consistent. This might be an alternative for the vacuum / analyze
>> > >> >> /
>> > >> >> reindex database commands also..
>> > >> >
>> > >> > Urgh. I don't have a problem with that syntax in general, but it
>> > >> > clashes pretty awfully with what we're already doing for REINDEX
>> > >> > otherwise.
>> > >> >
>> > >>
>> > >> Attached patches are latest version patch.
>> > >
>> > > Ok.
>> > >
>> > >
>> > >> I changed syntax to REINDEX ALL IN SCHEMA, but I felt a sense of
>> > >> discomfort a little
>> > >> as Robert mentioned.
>> > >>
>> > >
>> > > I understood, but the real problem will in a near future when the
>> > > features
>> > > will be pushed... :-)
>> > >
>> > > They are separated features, but maybe we can join this features to a
>> > > one
>> > > future commit... it's just an idea.
>> > >
>> > >
>> > >> Anyway, you can apply these patches in numerical order,
>> > >> can use REINDEX ALL IN SCHEMA feature and "-S/--schema" option in
>> > >> reindexdb.
>> > >>
>> > >> 000_reindex_all_in_schema_v2.patch : It contains REINDEX ALL IN
>> > >> SCHEMA
>> > >> feature
>> > >
>> > > 1) Compile without warnings
>> > >
>> > >
>> > > 2) IMHO you can add more test cases to better code coverage:
>> > >
>> > > * reindex a schema that doesn't exists
>> > > * try to run "reindex all in schema" inside a transaction block
>> > >
>> > >
>> > > 3) Isn't enough just?
>> > >
>> > > bool do_database = (kind == OBJECT_DATABASE);
>> > >
>> > > ... instead of...
>> > >
>> > > + bool do_database = (kind == OBJECT_DATABASE) ? true : false;
>> > >
>> > >
>> > > 4) IMHO you can add other Assert to check valid relkinds, like:
>> > >
>> > > Assert(kind == OBJECT_DATABASE || kind == OBJECT_SCHEMA);
>> > >
>> > >
>> > > 5) I think is more legible:
>> > >
>> > > /* Get OID of object for result */
>> > > if (do_database)
>> > > objectOid = MyDatabaseId
>> > > else
>> > > objectOid = get_namespace_oid(objectName, false);
>> > >
>> > > ... insead of ...
>> > >
>> > > + /* Get OID of object for result */
>> > > + objectOid = (do_database) ? MyDatabaseId :
>> > > get_namespace_oid(objectName,
>> > > false);
>> > >
>> > >
>> > >
>> > >> 001_Add_schema_option_to_reindexdb_v1.patch : It contains reindexdb
>> > >> "-S/--schema" supporting
>> > >>
>> > >
>> > > The code itself is good for me, but IMHO you can add test cases to
>> > > src/bin/scripts/t/090_reindexdb.pl
>> > >
>> >
>> > Thank you for reviewing.
>>
>> You're welcome!
>>
>>
>> > I agree 2) - 5).
>>
>> :-)
>>
>>
>> > Attached patch is latest version patch I modified above.
>>
>> All is fine to me now... all work as expected and no compiler warnings.
>>
>> There are just a little fix to do in src/bin/scripts/t/090_reindexdb.pl
>>
>> -use Test::More tests => 7;
>> +use Test::More tests => 8;
>>
>> Because you added a new testcase to suittest, so you need to increase the
>> test count at beginning of the file.
>>
>
> Patch attached. Now the regress run without errors.
>

Thank you for reviewing and revising!
I also did successfully.
It looks good to me :)

Regards,

-------
Sawada Masahiko


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-20 14:01:25
Message-ID: CAFcNs+r6KjSe2eF=o18+9RZzVB+xKTV0TK9TEB9GMGb3Le=6=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 20, 2014 at 11:24 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
wrote:
>
> On Mon, Oct 20, 2014 at 9:41 AM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
> >
> >
> > On Sun, Oct 19, 2014 at 10:37 PM, Fabrízio de Royes Mello
> > <fabriziomello(at)gmail(dot)com> wrote:
> >>
> >>
> >> On Sun, Oct 19, 2014 at 1:02 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com
>
> >> wrote:
> >> >
> >> > On Fri, Oct 17, 2014 at 4:32 AM, Fabrízio de Royes Mello
> >> > <fabriziomello(at)gmail(dot)com> wrote:
> >> > > On Wed, Oct 15, 2014 at 11:41 AM, Sawada Masahiko
> >> > > <sawada(dot)mshk(at)gmail(dot)com>
> >> > > wrote:
> >> > >>
> >> > >> On Mon, Oct 13, 2014 at 11:16 PM, Robert Haas <
robertmhaas(at)gmail(dot)com>
> >> > >> wrote:
> >> > >> > On Sun, Oct 12, 2014 at 1:27 PM, Stephen Frost <
sfrost(at)snowman(dot)net>
> >> > >> > wrote:
> >> > >> >> * Alvaro Herrera (alvherre(at)2ndquadrant(dot)com) wrote:
> >> > >> >>> Sawada Masahiko wrote:
> >> > >> >>> > Attached WIP patch adds new syntax REINEX SCHEMA which does
> >> > >> >>> > reindexing
> >> > >> >>> > all table of specified schema.
> >> > >> >>> > There are syntax dose reindexing specified index, per table
and
> >> > >> >>> > per
> >> > >> >>> > database,
> >> > >> >>> > but we can not do reindexing per schema for now.
> >> > >> >>>
> >> > >> >>> It seems doubtful that there really is much use for this
feature,
> >> > >> >>> but
> >> > >> >>> if
> >> > >> >>> there is, I think a better syntax precedent is the new ALTER
> >> > >> >>> TABLE ALL
> >> > >> >>> IN TABLESPACE thingy, rather than your proposed REINDEX
SCHEMA.
> >> > >> >>> Something like REINDEX TABLE ALL IN SCHEMA perhaps.
> >> > >> >>
> >> > >> >> Yeah, I tend to agree that we should be looking at the 'ALL IN
> >> > >> >> TABLESPACE' and 'ALL IN SCHEMA' type of commands to keep things
> >> > >> >> consistent. This might be an alternative for the vacuum /
analyze
> >> > >> >> /
> >> > >> >> reindex database commands also..
> >> > >> >
> >> > >> > Urgh. I don't have a problem with that syntax in general, but
it
> >> > >> > clashes pretty awfully with what we're already doing for REINDEX
> >> > >> > otherwise.
> >> > >> >
> >> > >>
> >> > >> Attached patches are latest version patch.
> >> > >
> >> > > Ok.
> >> > >
> >> > >
> >> > >> I changed syntax to REINDEX ALL IN SCHEMA, but I felt a sense of
> >> > >> discomfort a little
> >> > >> as Robert mentioned.
> >> > >>
> >> > >
> >> > > I understood, but the real problem will in a near future when the
> >> > > features
> >> > > will be pushed... :-)
> >> > >
> >> > > They are separated features, but maybe we can join this features
to a
> >> > > one
> >> > > future commit... it's just an idea.
> >> > >
> >> > >
> >> > >> Anyway, you can apply these patches in numerical order,
> >> > >> can use REINDEX ALL IN SCHEMA feature and "-S/--schema" option in
> >> > >> reindexdb.
> >> > >>
> >> > >> 000_reindex_all_in_schema_v2.patch : It contains REINDEX ALL IN
> >> > >> SCHEMA
> >> > >> feature
> >> > >
> >> > > 1) Compile without warnings
> >> > >
> >> > >
> >> > > 2) IMHO you can add more test cases to better code coverage:
> >> > >
> >> > > * reindex a schema that doesn't exists
> >> > > * try to run "reindex all in schema" inside a transaction block
> >> > >
> >> > >
> >> > > 3) Isn't enough just?
> >> > >
> >> > > bool do_database = (kind == OBJECT_DATABASE);
> >> > >
> >> > > ... instead of...
> >> > >
> >> > > + bool do_database = (kind == OBJECT_DATABASE) ? true : false;
> >> > >
> >> > >
> >> > > 4) IMHO you can add other Assert to check valid relkinds, like:
> >> > >
> >> > > Assert(kind == OBJECT_DATABASE || kind == OBJECT_SCHEMA);
> >> > >
> >> > >
> >> > > 5) I think is more legible:
> >> > >
> >> > > /* Get OID of object for result */
> >> > > if (do_database)
> >> > > objectOid = MyDatabaseId
> >> > > else
> >> > > objectOid = get_namespace_oid(objectName, false);
> >> > >
> >> > > ... insead of ...
> >> > >
> >> > > + /* Get OID of object for result */
> >> > > + objectOid = (do_database) ? MyDatabaseId :
> >> > > get_namespace_oid(objectName,
> >> > > false);
> >> > >
> >> > >
> >> > >
> >> > >> 001_Add_schema_option_to_reindexdb_v1.patch : It contains
reindexdb
> >> > >> "-S/--schema" supporting
> >> > >>
> >> > >
> >> > > The code itself is good for me, but IMHO you can add test cases to
> >> > > src/bin/scripts/t/090_reindexdb.pl
> >> > >
> >> >
> >> > Thank you for reviewing.
> >>
> >> You're welcome!
> >>
> >>
> >> > I agree 2) - 5).
> >>
> >> :-)
> >>
> >>
> >> > Attached patch is latest version patch I modified above.
> >>
> >> All is fine to me now... all work as expected and no compiler warnings.
> >>
> >> There are just a little fix to do in src/bin/scripts/t/090_reindexdb.pl
> >>
> >> -use Test::More tests => 7;
> >> +use Test::More tests => 8;
> >>
> >> Because you added a new testcase to suittest, so you need to increase
the
> >> test count at beginning of the file.
> >>
> >
> > Patch attached. Now the regress run without errors.
> >
>
> Thank you for reviewing and revising!

You're welcome!

> I also did successfully.
> It looks good to me :)
>

Changed status to "Ready for commiter".

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-22 23:21:21
Message-ID: 20141022232121.GF1791@alvin.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sawada Masahiko wrote:

> Thank you for reviewing.
> I agree 2) - 5).
> Attached patch is latest version patch I modified above.
> Also, I noticed I had forgotten to add the patch regarding document of
> reindexdb.

Please don't use pg_catalog in the regression test. That way we will
need to update the expected file whenever a new catalog is added, which
seems pointless. Maybe create a schema with a couple of tables
specifically for this, instead.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-10-23 18:41:05
Message-ID: CAFcNs+rptBOhFsQTMDgKuqfu0TYZFS+j-_JyFd0HGCapaBt_ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Oct 22, 2014 at 9:21 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:
>
> Sawada Masahiko wrote:
>
> > Thank you for reviewing.
> > I agree 2) - 5).
> > Attached patch is latest version patch I modified above.
> > Also, I noticed I had forgotten to add the patch regarding document of
> > reindexdb.
>
> Please don't use pg_catalog in the regression test. That way we will
> need to update the expected file whenever a new catalog is added, which
> seems pointless. Maybe create a schema with a couple of tables
> specifically for this, instead.
>

Attached new regression test.

Isn't better join the two patches in just one?

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

Attachment Content-Type Size
000_reindex_all_in_schema_v4.patch text/x-patch 9.9 KB

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-06 11:00:16
Message-ID: CAHGQGwH9PpNKgcwp=VSr7O4RV8Jscp4s4yfWza07xedJAc31tw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Oct 24, 2014 at 3:41 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> On Wed, Oct 22, 2014 at 9:21 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
> wrote:
>>
>> Sawada Masahiko wrote:
>>
>> > Thank you for reviewing.
>> > I agree 2) - 5).
>> > Attached patch is latest version patch I modified above.
>> > Also, I noticed I had forgotten to add the patch regarding document of
>> > reindexdb.
>>
>> Please don't use pg_catalog in the regression test. That way we will
>> need to update the expected file whenever a new catalog is added, which
>> seems pointless. Maybe create a schema with a couple of tables
>> specifically for this, instead.
>>
>
> Attached new regression test.

Hunk #1 FAILED at 1.
1 out of 2 hunks FAILED -- saving rejects to file
src/bin/scripts/t/090_reindexdb.pl.rej

I tried to apply the 001 patch after applying the 000, but it was not
applied cleanly.

At least to me, it's more intuitive to use "SCHEMA" instead of "ALL IN SCHEMA"
here because we already use "DATABASE" instead of "ALL IN DATABASE".

Regards,

--
Fujii Masao


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-17 14:07:46
Message-ID: CAD21AoDeMR5nWCKCe7JiwSuOLSH8zQdMCbLnrpvPf9=m_4ZZsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Nov 6, 2014 at 8:00 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Fri, Oct 24, 2014 at 3:41 AM, Fabrízio de Royes Mello
> <fabriziomello(at)gmail(dot)com> wrote:
>> On Wed, Oct 22, 2014 at 9:21 PM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
>> wrote:
>>>
>>> Sawada Masahiko wrote:
>>>
>>> > Thank you for reviewing.
>>> > I agree 2) - 5).
>>> > Attached patch is latest version patch I modified above.
>>> > Also, I noticed I had forgotten to add the patch regarding document of
>>> > reindexdb.
>>>
>>> Please don't use pg_catalog in the regression test. That way we will
>>> need to update the expected file whenever a new catalog is added, which
>>> seems pointless. Maybe create a schema with a couple of tables
>>> specifically for this, instead.
>>>
>>
>> Attached new regression test.
>
> Hunk #1 FAILED at 1.
> 1 out of 2 hunks FAILED -- saving rejects to file
> src/bin/scripts/t/090_reindexdb.pl.rej
>
> I tried to apply the 001 patch after applying the 000, but it was not
> applied cleanly.
>
> At least to me, it's more intuitive to use "SCHEMA" instead of "ALL IN SCHEMA"
> here because we already use "DATABASE" instead of "ALL IN DATABASE".
>

Thank you for reporting.

Um, that's one way of looking at it
I think It's not quite new syntax, and we have not used "ALL IN"
clause in REINDEX command by now.
If we add SQL command to reindex table of all in table space as newly syntax,
we might be able to name it "REINDEX TABLE ALL IN TABLESPACE".

Anyway, I created patch of "REINDEX SCHEMA" version, and attached.
Also inapplicable problem has been solved.

Regards,

-------
Sawada Masahiko

Attachment Content-Type Size
001_Add_schema_option_to_reindexdb_v4.patch application/octet-stream 6.8 KB
000_reindex_schema_v5.patch application/octet-stream 9.8 KB

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-18 16:37:20
Message-ID: CA+U5nMJdx4-HPYKk155=Tuz+saGnif7ZBraPDd-DYzUNVOpe0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 23 October 2014 00:21, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:

>> Attached patch is latest version patch I modified above.
>> Also, I noticed I had forgotten to add the patch regarding document of
>> reindexdb.
>
> Please don't use pg_catalog in the regression test. That way we will
> need to update the expected file whenever a new catalog is added, which
> seems pointless. Maybe create a schema with a couple of tables
> specifically for this, instead.

These patches look fine to me. Don't see anybody objecting either.

Are you looking to commit them, or shall I?

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-26 06:48:24
Message-ID: CAB7nPqS_Gud2mc4OYyWvMy3SsVaPR1zH0xaWoq-FrA0a9+hMAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Nov 19, 2014 at 1:37 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> On 23 October 2014 00:21, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
>
>>> Attached patch is latest version patch I modified above.
>>> Also, I noticed I had forgotten to add the patch regarding document of
>>> reindexdb.
>>
>> Please don't use pg_catalog in the regression test. That way we will
>> need to update the expected file whenever a new catalog is added, which
>> seems pointless. Maybe create a schema with a couple of tables
>> specifically for this, instead.
>
> These patches look fine to me. Don't see anybody objecting either.
>
> Are you looking to commit them, or shall I?

IMO, SCHEMA is just but fine, that's more consistent with the existing
syntax we have for database and tables.

Btw, there is an error in this patch, there are no ACL checks on the
schema for the user doing the REINDEX, so any user is able to perform
a REINDEX on any schema. Here is an example for a given user, let's
say "poo'":
=> create table foo.g (a int);
ERROR: 42501: permission denied for schema foo
LOCATION: aclcheck_error, aclchk.c:3371
=> reindex schema foo ;
NOTICE: 00000: table "foo.c" was reindexed
LOCATION: ReindexDatabaseOrSchema, indexcmds.c:1930
REINDEX
A regression test to check that would be good as well.

Also, ISTM that it is awkward to modify the values of do_user and
do_system like that in ReindexDatabase for two reasons:
1) They should be set in gram.y
2) This patch passes as a new argument of ReindexDatabase the object
type, something that is overlapping with what do_user and do_system
are aimed for. Why not simply defining a new object type
OBJECT_SYSTEM? As this patch introduces a new object category for
REINDEX, this patch seems to be a good occasion to remove the boolean
dance in REINDEX at the cost of having a new object type for the
concept of a system, which would be a way to define the system
catalogs as a whole.

Another thing, ReindexDatabaseOrSchema should be renamed to ReindexObject.

So, I think that we need to think a bit more here. We are not far from
smth that could be committed, so marking as "Waiting on Author" for
now. Thoughts?
--
Michael


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-26 15:55:48
Message-ID: CAD21AoDgqaKy3cXk=Yiek2bbq4mA-_zXxL7S-EAEVJT6TQhGXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Nov 26, 2014 at 3:48 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Wed, Nov 19, 2014 at 1:37 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> On 23 October 2014 00:21, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
>>
>>>> Attached patch is latest version patch I modified above.
>>>> Also, I noticed I had forgotten to add the patch regarding document of
>>>> reindexdb.
>>>
>>> Please don't use pg_catalog in the regression test. That way we will
>>> need to update the expected file whenever a new catalog is added, which
>>> seems pointless. Maybe create a schema with a couple of tables
>>> specifically for this, instead.
>>
>> These patches look fine to me. Don't see anybody objecting either.
>>
>> Are you looking to commit them, or shall I?
>
> IMO, SCHEMA is just but fine, that's more consistent with the existing
> syntax we have for database and tables.
>
> Btw, there is an error in this patch, there are no ACL checks on the
> schema for the user doing the REINDEX, so any user is able to perform
> a REINDEX on any schema. Here is an example for a given user, let's
> say "poo'":
> => create table foo.g (a int);
> ERROR: 42501: permission denied for schema foo
> LOCATION: aclcheck_error, aclchk.c:3371
> => reindex schema foo ;
> NOTICE: 00000: table "foo.c" was reindexed
> LOCATION: ReindexDatabaseOrSchema, indexcmds.c:1930
> REINDEX
> A regression test to check that would be good as well.
>

Thank you for testing this patch.
It's a bug.
I will fix it and add test case to regression test.

> Also, ISTM that it is awkward to modify the values of do_user and
> do_system like that in ReindexDatabase for two reasons:
> 1) They should be set in gram.y
> 2) This patch passes as a new argument of ReindexDatabase the object
> type, something that is overlapping with what do_user and do_system
> are aimed for. Why not simply defining a new object type
> OBJECT_SYSTEM? As this patch introduces a new object category for
> REINDEX, this patch seems to be a good occasion to remove the boolean
> dance in REINDEX at the cost of having a new object type for the
> concept of a system, which would be a way to define the system
> catalogs as a whole.

+1 to define new something object type and remove do_user and do_system.
But if we add OBJECT_SYSTEM to ObjectType data type,
system catalogs are OBJECT_SYSTEM as well as OBJECT_TABLE.
It's a bit redundant?

> Another thing, ReindexDatabaseOrSchema should be renamed to ReindexObject.
> So, I think that we need to think a bit more here. We are not far from
> smth that could be committed, so marking as "Waiting on Author" for
> now. Thoughts?

Is the table also kind of "object"?

Regards,

-------
Sawada Masahiko


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-27 04:07:15
Message-ID: CAB7nPqR9xpqBNLo0sgjQsFfAPZ3hPc7LAC_+m9bL4=Eo4Er2kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Nov 27, 2014 at 12:55 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
> +1 to define new something object type and remove do_user and do_system.
> But if we add OBJECT_SYSTEM to ObjectType data type,
> system catalogs are OBJECT_SYSTEM as well as OBJECT_TABLE.
> It's a bit redundant?
Yes, kind of. That's a superset of a type of relations, aka a set of
catalog tables. If you find something cleaner to propose, feel free.

>> Another thing, ReindexDatabaseOrSchema should be renamed to ReindexObject.
>> So, I think that we need to think a bit more here. We are not far from
>> smth that could be committed, so marking as "Waiting on Author" for
>> now. Thoughts?
>
> Is the table also kind of "object"?
Sorry, I am not sure I follow you here. Indexes and tables have
already their relkind set in ReindexStmt, and I think that we're fine
to continue letting them go in their own reindex code path for now.
--
Michael


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-27 11:18:57
Message-ID: CAD21AoD+Wb4eeRxp_La0X4UHvM9UVBP-3gnQSkDBBbXRHRrhLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Nov 27, 2014 at 1:07 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Nov 27, 2014 at 12:55 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
>> +1 to define new something object type and remove do_user and do_system.
>> But if we add OBJECT_SYSTEM to ObjectType data type,
>> system catalogs are OBJECT_SYSTEM as well as OBJECT_TABLE.
>> It's a bit redundant?
> Yes, kind of. That's a superset of a type of relations, aka a set of
> catalog tables. If you find something cleaner to propose, feel free.

I thought we can add new struct like ReindexObjectType which has
REINDEX_OBJECT_TABLE,
REINDEX_OBJECT_SYSTEM and so on. It's similar to GRANT syntax.

>>> Another thing, ReindexDatabaseOrSchema should be renamed to ReindexObject.
>>> So, I think that we need to think a bit more here. We are not far from
>>> smth that could be committed, so marking as "Waiting on Author" for
>>> now. Thoughts?
>>
>> Is the table also kind of "object"?
> Sorry, I am not sure I follow you here. Indexes and tables have
> already their relkind set in ReindexStmt, and I think that we're fine
> to continue letting them go in their own reindex code path for now.

It was not enough, sorry.
I mean that there is already ReindexTable() function.
if we renamed ReindexObject, I would feel uncomfortable feeling.
Because table is also kind of "object".

Regards,

-------
Sawada Masahiko


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-11-27 14:43:13
Message-ID: CAB7nPqT4tKNoXn5pgU114x_oLGJ__QZ5Ykn5+M_dGTL-oanp1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Nov 27, 2014 at 8:18 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Thu, Nov 27, 2014 at 1:07 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> On Thu, Nov 27, 2014 at 12:55 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
>>> +1 to define new something object type and remove do_user and do_system.
>>> But if we add OBJECT_SYSTEM to ObjectType data type,
>>> system catalogs are OBJECT_SYSTEM as well as OBJECT_TABLE.
>>> It's a bit redundant?
>> Yes, kind of. That's a superset of a type of relations, aka a set of
>> catalog tables. If you find something cleaner to propose, feel free.
>
> I thought we can add new struct like ReindexObjectType which has
> REINDEX_OBJECT_TABLE,
> REINDEX_OBJECT_SYSTEM and so on. It's similar to GRANT syntax.
Check.

>>>> Another thing, ReindexDatabaseOrSchema should be renamed to ReindexObject.
>>>> So, I think that we need to think a bit more here. We are not far from
>>>> smth that could be committed, so marking as "Waiting on Author" for
>>>> now. Thoughts?
>>>
>>> Is the table also kind of "object"?
>> Sorry, I am not sure I follow you here. Indexes and tables have
>> already their relkind set in ReindexStmt, and I think that we're fine
>> to continue letting them go in their own reindex code path for now.
>
> It was not enough, sorry.
> I mean that there is already ReindexTable() function.
> if we renamed ReindexObject, I would feel uncomfortable feeling.
> Because table is also kind of "object".
Check.

If you get that done, I'll have an extra look at it and then let's
have a committer look at it.
Regards,
--
Michael


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-01 14:29:09
Message-ID: CAD21AoDzxo3paAr8=PCQDx=eBS7Aqc3AVv8FbKjTf-J_67fYUQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Nov 27, 2014 at 11:43 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Nov 27, 2014 at 8:18 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
>> On Thu, Nov 27, 2014 at 1:07 PM, Michael Paquier
>> <michael(dot)paquier(at)gmail(dot)com> wrote:
>>> On Thu, Nov 27, 2014 at 12:55 AM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
>>>> +1 to define new something object type and remove do_user and do_system.
>>>> But if we add OBJECT_SYSTEM to ObjectType data type,
>>>> system catalogs are OBJECT_SYSTEM as well as OBJECT_TABLE.
>>>> It's a bit redundant?
>>> Yes, kind of. That's a superset of a type of relations, aka a set of
>>> catalog tables. If you find something cleaner to propose, feel free.
>>
>> I thought we can add new struct like ReindexObjectType which has
>> REINDEX_OBJECT_TABLE,
>> REINDEX_OBJECT_SYSTEM and so on. It's similar to GRANT syntax.
> Check.
>
>>>>> Another thing, ReindexDatabaseOrSchema should be renamed to ReindexObject.
>>>>> So, I think that we need to think a bit more here. We are not far from
>>>>> smth that could be committed, so marking as "Waiting on Author" for
>>>>> now. Thoughts?
>>>>
>>>> Is the table also kind of "object"?
>>> Sorry, I am not sure I follow you here. Indexes and tables have
>>> already their relkind set in ReindexStmt, and I think that we're fine
>>> to continue letting them go in their own reindex code path for now.
>>
>> It was not enough, sorry.
>> I mean that there is already ReindexTable() function.
>> if we renamed ReindexObject, I would feel uncomfortable feeling.
>> Because table is also kind of "object".
> Check.
>
> If you get that done, I'll have an extra look at it and then let's
> have a committer look at it.

Attached patch is latest version.
I added new enum values like REINDEX_OBJECT_XXX,
and changed ReindexObject() function.
Also ACL problem is fixed for this version.

Regards,

-------
Sawada Masahiko

Attachment Content-Type Size
000_reindex_schema_v6.patch application/octet-stream 12.9 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-02 06:42:23
Message-ID: CAB7nPqQW1XYqFvkodsok7nCb5rwMPS4n14UbqTQcgGHxeT9ifQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Dec 1, 2014 at 11:29 PM, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com> wrote:
> On Thu, Nov 27, 2014 at 11:43 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> If you get that done, I'll have an extra look at it and then let's
>> have a committer look at it.
>
> Attached patch is latest version.
> I added new enum values like REINDEX_OBJECT_XXX,
> and changed ReindexObject() function.
> Also ACL problem is fixed for this version.

Thanks for the updated version.
I have been looking at this patch more deeply, and I noticed a couple
of things that were missing or mishandled:
- The patch completely ignored that a catalog schema could be reindexed
- When reindexing pg_catalog as a schema, it is critical to reindex
pg_class first as reindex_relation updates pg_class.
- gram.y generated some warnings because ReindexObjectType stuff was
casted as ObjectType.
- There was a memory leak, the scan keys palloc'd in ReindexObject
were not pfree'd
- Using do_user, do_system and now do_database was really confusing
and reduced code lisibility. I reworked it using the object kind
- The patch to support SCHEMA in reindexdb has been forgotten.
Reattaching it here.
Adding on top of that a couple of things cleaned up, like docs and
typos, and I got the patch attached. Let's have a committer have a
look a it now, I am marking that as "Ready for Committer".
Regards,
--
Michael

Attachment Content-Type Size
0001-Support-for-REINDEX-SCHEMA.patch text/x-diff 16.6 KB
0002-Add-support-for-REINDEX-SCHEMA-in-reindexdb.patch text/x-diff 7.3 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 01:10:50
Message-ID: CAB7nPqSaE01EXw6wJfdFOpxpG4N527vZfJM_OtXg6qZhhd3X8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 2, 2014 at 3:42 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> Adding on top of that a couple of things cleaned up, like docs and
> typos, and I got the patch attached. Let's have a committer have a
> look a it now, I am marking that as "Ready for Committer".
For the archives, this has been committed as fe263d1. Thanks Simon for
looking and the final push. And sorry that I didn't spot the issue
with tap tests when reviewing, check-world passed but my dev VM missed
necessary perl packages.
Regards,
--
Michael


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 07:44:30
Message-ID: CAB7nPqR1W6KnDh0E4huZ3VWj3EjMZ7qmeUoa0v9avetMHK_u4g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 9, 2014 at 10:10 AM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Tue, Dec 2, 2014 at 3:42 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> Adding on top of that a couple of things cleaned up, like docs and
>> typos, and I got the patch attached. Let's have a committer have a
>> look a it now, I am marking that as "Ready for Committer".
> For the archives, this has been committed as fe263d1. Thanks Simon for
> looking and the final push. And sorry that I didn't spot the issue
> with tap tests when reviewing, check-world passed but my dev VM missed
> necessary perl packages.
While re-looking at that. I just found that when selecting the
relations that are reindexed for a schema we ignore materialized view
as the key scan is only done using 'r' as relkind. The patch attached
fixes that.
Thanks,
--
Michael

Attachment Content-Type Size
20141209_reindex_schema_matview.patch application/x-patch 4.2 KB

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 08:17:15
Message-ID: CAB7nPqQjqdt0oE=32e3g=HEbha4rdLXSn95W3-YkEGrmv17zsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 9, 2014 at 4:44 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Tue, Dec 9, 2014 at 10:10 AM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> On Tue, Dec 2, 2014 at 3:42 PM, Michael Paquier
>> <michael(dot)paquier(at)gmail(dot)com> wrote:
>>> Adding on top of that a couple of things cleaned up, like docs and
>>> typos, and I got the patch attached. Let's have a committer have a
>>> look a it now, I am marking that as "Ready for Committer".
>> For the archives, this has been committed as fe263d1. Thanks Simon for
>> looking and the final push. And sorry that I didn't spot the issue
>> with tap tests when reviewing, check-world passed but my dev VM missed
>> necessary perl packages.
> While re-looking at that. I just found that when selecting the
> relations that are reindexed for a schema we ignore materialized view
> as the key scan is only done using 'r' as relkind. The patch attached
> fixes that.
Here is an updated patch doing as well that:
- Regression test checking if user has permissions on schema was broken
- Silent NOTICE messages of REINDEX by having client_min_messages set
to WARINING (thoughts about having a plpgsql function doing
consistency checks of relfilenode before and after reindex?)
--
Michael

Attachment Content-Type Size
20141209_reindex_schema_fixes.patch application/x-patch 4.8 KB

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 09:00:37
Message-ID: CA+U5nMLGekYxAvdK4+MgSjYYHPPndVdkz7Zgoqk8gPQxDeQSZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 9 December 2014 at 17:17, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:

>> While re-looking at that. I just found that when selecting the
>> relations that are reindexed for a schema we ignore materialized view
>> as the key scan is only done using 'r' as relkind. The patch attached
>> fixes that.
> Here is an updated patch doing as well that:
> - Regression test checking if user has permissions on schema was broken
> - Silent NOTICE messages of REINDEX by having client_min_messages set
> to WARINING (thoughts about having a plpgsql function doing
> consistency checks of relfilenode before and after reindex?)

ISTM that REINDEX is not consistent with VACUUM, ANALYZE or CLUSTER in
the way it issues NOTICE messages.

I'm inclined to simply remove the NOTICE messages, except when a
REINDEX ... VERBOSE is requested.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 09:23:36
Message-ID: CAD21AoAwzF7Zw5dFoDEMfA4jCv5Mu+C9HbGQLWs2-MDgRt3_1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tuesday, December 9, 2014, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:

> On 9 December 2014 at 17:17, Michael Paquier <michael(dot)paquier(at)gmail(dot)com
> <javascript:;>> wrote:
>
> >> While re-looking at that. I just found that when selecting the
> >> relations that are reindexed for a schema we ignore materialized view
> >> as the key scan is only done using 'r' as relkind. The patch attached
> >> fixes that.
> > Here is an updated patch doing as well that:
> > - Regression test checking if user has permissions on schema was broken
> > - Silent NOTICE messages of REINDEX by having client_min_messages set
> > to WARINING (thoughts about having a plpgsql function doing
> > consistency checks of relfilenode before and after reindex?)
>
> ISTM that REINDEX is not consistent with VACUUM, ANALYZE or CLUSTER in
> the way it issues NOTICE messages.
>
> I'm inclined to simply remove the NOTICE messages, except when a
> REINDEX ... VERBOSE is requested.
>
>
+1 to remove the NOTICE messages except when specifying VERBOSE.

It would output a lot of messages if there are many table in schema.
If nobody objects to it, I will work on this.

Regards,

--
Sawada Masahiko

--
Regards,

-------
Sawada Masahiko


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 09:43:49
Message-ID: CAB7nPqQB-QBVQ+PAKCTmPMUzOyVaM1XgF-VRjiqSGg9gcwJqzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 9, 2014 at 6:00 PM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
> On 9 December 2014 at 17:17, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>
>>> While re-looking at that. I just found that when selecting the
>>> relations that are reindexed for a schema we ignore materialized view
>>> as the key scan is only done using 'r' as relkind. The patch attached
>>> fixes that.
>> Here is an updated patch doing as well that:
>> - Regression test checking if user has permissions on schema was broken
>> - Silent NOTICE messages of REINDEX by having client_min_messages set
>> to WARINING (thoughts about having a plpgsql function doing
>> consistency checks of relfilenode before and after reindex?)
>
> ISTM that REINDEX is not consistent with VACUUM, ANALYZE or CLUSTER in
> the way it issues NOTICE messages.
>
> I'm inclined to simply remove the NOTICE messages, except when a
> REINDEX ... VERBOSE is requested.
OK. Perhaps that's not worth mentioning in the release notes, but some
users may be used to the old behavior. What about the other issues
(regression test for permissions incorrect and matviews)?
--
Michael


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 12:21:31
Message-ID: CAB7nPqRhPGKVfASinv2zkfvRs2Kwwvwpa8fqznCMeJtFFW2VqA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 9, 2014 at 6:43 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> OK. Perhaps that's not worth mentioning in the release notes, but some
> users may be used to the old behavior. What about the other issues
> (regression test for permissions incorrect and matviews)?
Here is in any case an updated patch to fix all those things rebased
on latest HEAD (ae4e688).
Thanks,
--
Michael

Attachment Content-Type Size
20141209_reindex_schema_fixes_v2.patch application/x-patch 4.1 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndQuadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 14:59:24
Message-ID: 1154.1418137164@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> ISTM that REINDEX is not consistent with VACUUM, ANALYZE or CLUSTER in
> the way it issues NOTICE messages.

> I'm inclined to simply remove the NOTICE messages, except when a
> REINDEX ... VERBOSE is requested.

My recollection is that those other commands do issue messages always,
but at some DEBUGn log level when not VERBOSE. Ideally REINDEX would
adopt that same behavior.

regards, tom lane


From: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 15:34:21
Message-ID: CAD21AoCCO-o6PyQOn-2ok9WRdTXkuWjHChNHGvaA8oU00Wkscw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 9, 2014 at 11:59 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
>> ISTM that REINDEX is not consistent with VACUUM, ANALYZE or CLUSTER in
>> the way it issues NOTICE messages.
>
>> I'm inclined to simply remove the NOTICE messages, except when a
>> REINDEX ... VERBOSE is requested.
>
> My recollection is that those other commands do issue messages always,
> but at some DEBUGn log level when not VERBOSE. Ideally REINDEX would
> adopt that same behavior.
>

So it seems to that REINDEX command issues messages as INFO level when
that is specified VERBOSE option.
If not specified, it issue message as DEBUG2.

Regards,

-------
Sawada Masahiko


From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 16:37:44
Message-ID: CAFcNs+o+DZ9znhdmz=kSRXBL3=mZiuvYjcVmT+9cerJdTfLcMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 9, 2014 at 10:21 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> On Tue, Dec 9, 2014 at 6:43 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
> > OK. Perhaps that's not worth mentioning in the release notes, but some
> > users may be used to the old behavior. What about the other issues
> > (regression test for permissions incorrect and matviews)?
> Here is in any case an updated patch to fix all those things rebased
> on latest HEAD (ae4e688).
>

The patch is fine:
- No compiler warnings
- Added properly regressions tests and run ok

There are no changes in the docs. Maybe we can mention matviews on REINDEX
SCHEMA docs, what do you think?

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Fabrízio Mello <fabriziomello(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-09 23:31:34
Message-ID: CAB7nPqRu9VED0-PvyQPf4PTNdVYabL=NuEmFE6N4EuUEWO6eDw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 10, 2014 at 1:37 AM, Fabrízio de Royes Mello
<fabriziomello(at)gmail(dot)com> wrote:
> On Tue, Dec 9, 2014 at 10:21 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
>>
>> On Tue, Dec 9, 2014 at 6:43 PM, Michael Paquier
>> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> > OK. Perhaps that's not worth mentioning in the release notes, but some
>> > users may be used to the old behavior. What about the other issues
>> > (regression test for permissions incorrect and matviews)?
>> Here is in any case an updated patch to fix all those things rebased
>> on latest HEAD (ae4e688).
>>
>
> The patch is fine:
> - No compiler warnings
> - Added properly regressions tests and run ok
>
> There are no changes in the docs. Maybe we can mention matviews on REINDEX
> SCHEMA docs, what do you think?
Current documentation tells that all the indexes in schema are
reindexed, only matviews and relations can have one, so that's
implicitly specified IMO. If in the future we add support for another
relkind and that it can have indexes, we won't need to update the docs
as well.
--
Michael


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-11 23:00:22
Message-ID: CA+U5nMLorGnQeYtxzCmVDmbQwZBOUZmTrLYA5aVuPzyUpRc6nA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 9 December 2014 at 12:21, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
> On Tue, Dec 9, 2014 at 6:43 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> OK. Perhaps that's not worth mentioning in the release notes, but some
>> users may be used to the old behavior. What about the other issues
>> (regression test for permissions incorrect and matviews)?
> Here is in any case an updated patch to fix all those things rebased
> on latest HEAD (ae4e688).
> Thanks,

I rewrote and applied this patch to ensure we didn't introduce further bugs.

Tests for the reindex part were rewritten from scratch also.

Rather unluckily that seems to have coincided with Tom's changes, so
I've only added the bits that have nothing to do with Tom's changes -
all of which stand.

(I just got going again after my flight back from Tokyo).

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-11 23:41:18
Message-ID: CAB7nPqRpcr1sBuoe3St4m1jBdOnV3=E0z-HeGOriYeXm9pmQ9w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Dec 12, 2014 at 8:00 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:

> On 9 December 2014 at 12:21, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
> > On Tue, Dec 9, 2014 at 6:43 PM, Michael Paquier
> > <michael(dot)paquier(at)gmail(dot)com> wrote:
> >> OK. Perhaps that's not worth mentioning in the release notes, but some
> >> users may be used to the old behavior. What about the other issues
> >> (regression test for permissions incorrect and matviews)?
> > Here is in any case an updated patch to fix all those things rebased
> > on latest HEAD (ae4e688).
> > Thanks,
>
> I rewrote and applied this patch to ensure we didn't introduce further
> bugs.
>
> Tests for the reindex part were rewritten from scratch also.
>
> Rather unluckily that seems to have coincided with Tom's changes, so
> I've only added the bits that have nothing to do with Tom's changes -
> all of which stand.
>

Glad that things are in order now. I have nothing else left to complain
about with this feature. Thanks.

(I just got going again after my flight back from Tokyo).
>
I understand going east makes one day longer :)
--
Michael


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-12 00:43:30
Message-ID: CAB7nPqR+2f=2Xr0LgouOxT+wTwRc2UNho+rTaF2FL8DcOnNshw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Dec 12, 2014 at 8:41 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:

> On Fri, Dec 12, 2014 at 8:00 AM, Simon Riggs <simon(at)2ndquadrant(dot)com>
> wrote:
>
>> Rather unluckily that seems to have coincided with Tom's changes, so
>> I've only added the bits that have nothing to do with Tom's changes -
>> all of which stand.
>>
> Glad that things are in order now. I have nothing else left to complain
> about with this feature. Thanks.
>
Actually there is one thing left: this patch from Sawada-san to finish the
cleanup of ReindexStmt for the boolean flags.
http://www.postgresql.org/message-id/CAD21AoCXFE1J+hSkbeJ80rqqnhR8m_YUxdGKwZ4dL8zPqT8gjg@mail.gmail.com

Regards,
--
Michael


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-12 01:19:59
Message-ID: CA+U5nM+fLYU7w_KYSOnf9e+iDbny5bw=1BZD13mPaz2zzFUWow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 11 December 2014 at 23:41, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:

> Glad that things are in order now. I have nothing else left to complain
> about with this feature. Thanks.

I think you've discovered a new meaning of Ready for Committer

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal : REINDEX SCHEMA
Date: 2014-12-12 01:31:33
Message-ID: CAB7nPqTHL5u88W9Y=WpEdRqu8h51edX82Q8egvy+K1RAtszmKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Dec 12, 2014 at 10:19 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>
> On 11 December 2014 at 23:41, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
> wrote:
>
> > Glad that things are in order now. I have nothing else left to complain
> > about with this feature. Thanks.
>
> I think you've discovered a new meaning of Ready for Committer
>
Yep. Sorry for missing so many things.
--
Michael