Lists: | pgsql-hackers |
---|
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2020-12-22 13:31:09 |
Message-ID: | CALj2ACU71s91G1EOzo-Xx7Z4mvF0dKq-mYeP5u4nikJWxPNRSA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi,
Currently, $subject is not allowed. We do plan the mat view query
before every refresh. I propose to show the explain/explain analyze of
the select part of the mat view in case of Refresh Mat View(RMV). It
will be useful for the user to know what exactly is being planned and
executed as part of RMV. Please note that we already have
explain/explain analyze CTAS/Create Mat View(CMV), where we show the
explain/explain analyze of the select part. This proposal will do the
same thing.
The behaviour can be like this:
EXPLAIN REFRESH MATERIALIZED VIEW mv1; --> will not refresh the mat
view, but shows the select part's plan of mat view.
EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW mv1; --> will refresh the
mat view and shows the select part's plan of mat view.
Thoughts? If okay, I will post a patch later.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2020-12-28 12:26:37 |
Message-ID: | CALj2ACUTxSVy=Empw8ZWQzA9n8UcikqOXSQTgdKSznwPP6Xwrw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Dec 22, 2020 at 7:01 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> Currently, $subject is not allowed. We do plan the mat view query
> before every refresh. I propose to show the explain/explain analyze of
> the select part of the mat view in case of Refresh Mat View(RMV). It
> will be useful for the user to know what exactly is being planned and
> executed as part of RMV. Please note that we already have
> explain/explain analyze CTAS/Create Mat View(CMV), where we show the
> explain/explain analyze of the select part. This proposal will do the
> same thing.
>
> The behaviour can be like this:
> EXPLAIN REFRESH MATERIALIZED VIEW mv1; --> will not refresh the mat
> view, but shows the select part's plan of mat view.
> EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW mv1; --> will refresh the
> mat view and shows the select part's plan of mat view.
>
> Thoughts? If okay, I will post a patch later.
Attaching below patches:
0001 - Rearrange Refresh Mat View Code - Currently, the function
ExecRefreshMatView in matview.c is having many lines of code which is
not at all good from readability and maintainability perspectives.
This patch adds a few functions and moves the code from
ExecRefreshMatView to them making the code look better.
0002 - EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW support and tests.
If this proposal is useful, I have few open points - 1) In the patch I
have added a new mat view info parameter to ExplainOneQuery(), do we
also need to add it to ExplainOneQuery_hook_type? 2) Do we document
(under respective command pages or somewhere else) that we allow
explain/explain analyze for a command?
Thoughts?
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Rearrange-Refresh-Mat-View-Code.patch | application/x-patch | 18.1 KB |
v1-0002-EXPLAIN-EXPLAIN-ANALYZE-REFRESH-MATERIALIZED-VIEW.patch | application/x-patch | 16.3 KB |
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-01-07 09:53:02 |
Message-ID: | CALj2ACXwfesLnhkKbdW+kmHw1VLaDcebEizF+=-0gTseNuVLzQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Dec 28, 2020 at 5:56 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Tue, Dec 22, 2020 at 7:01 PM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > Currently, $subject is not allowed. We do plan the mat view query
> > before every refresh. I propose to show the explain/explain analyze of
> > the select part of the mat view in case of Refresh Mat View(RMV). It
> > will be useful for the user to know what exactly is being planned and
> > executed as part of RMV. Please note that we already have
> > explain/explain analyze CTAS/Create Mat View(CMV), where we show the
> > explain/explain analyze of the select part. This proposal will do the
> > same thing.
> >
> > The behaviour can be like this:
> > EXPLAIN REFRESH MATERIALIZED VIEW mv1; --> will not refresh the mat
> > view, but shows the select part's plan of mat view.
> > EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW mv1; --> will refresh the
> > mat view and shows the select part's plan of mat view.
> >
> > Thoughts? If okay, I will post a patch later.
>
> Attaching below patches:
>
> 0001 - Rearrange Refresh Mat View Code - Currently, the function
> ExecRefreshMatView in matview.c is having many lines of code which is
> not at all good from readability and maintainability perspectives.
> This patch adds a few functions and moves the code from
> ExecRefreshMatView to them making the code look better.
>
> 0002 - EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW support and tests.
>
> If this proposal is useful, I have few open points - 1) In the patch I
> have added a new mat view info parameter to ExplainOneQuery(), do we
> also need to add it to ExplainOneQuery_hook_type? 2) Do we document
> (under respective command pages or somewhere else) that we allow
> explain/explain analyze for a command?
>
> Thoughts?
Attaching v2 patch set reabsed on the latest master f7a1a805cb. And
also added an entry for upcoming commitfest -
https://commitfest.postgresql.org/32/2928/
Please consider the v2 patches for further review.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Rearrange-Refresh-Mat-View-Code.patch | application/octet-stream | 18.1 KB |
v2-0002-EXPLAIN-EXPLAIN-ANALYZE-REFRESH-MATERIALIZED-VIEW.patch | application/octet-stream | 16.3 KB |
From: | japin <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-01-08 08:20:15 |
Message-ID: | MEYP282MB166903A68C039DE688918B3FB6AE0@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, 07 Jan 2021 at 17:53, Bharath Rupireddy wrote:
> On Mon, Dec 28, 2020 at 5:56 PM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>>
>> On Tue, Dec 22, 2020 at 7:01 PM Bharath Rupireddy
>> <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>> > Currently, $subject is not allowed. We do plan the mat view query
>> > before every refresh. I propose to show the explain/explain analyze of
>> > the select part of the mat view in case of Refresh Mat View(RMV). It
>> > will be useful for the user to know what exactly is being planned and
>> > executed as part of RMV. Please note that we already have
>> > explain/explain analyze CTAS/Create Mat View(CMV), where we show the
>> > explain/explain analyze of the select part. This proposal will do the
>> > same thing.
>> >
>> > The behaviour can be like this:
>> > EXPLAIN REFRESH MATERIALIZED VIEW mv1; --> will not refresh the mat
>> > view, but shows the select part's plan of mat view.
>> > EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW mv1; --> will refresh the
>> > mat view and shows the select part's plan of mat view.
>> >
>> > Thoughts? If okay, I will post a patch later.
>>
>> Attaching below patches:
>>
>> 0001 - Rearrange Refresh Mat View Code - Currently, the function
>> ExecRefreshMatView in matview.c is having many lines of code which is
>> not at all good from readability and maintainability perspectives.
>> This patch adds a few functions and moves the code from
>> ExecRefreshMatView to them making the code look better.
>>
>> 0002 - EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW support and tests.
>>
>> If this proposal is useful, I have few open points - 1) In the patch I
>> have added a new mat view info parameter to ExplainOneQuery(), do we
>> also need to add it to ExplainOneQuery_hook_type? 2) Do we document
>> (under respective command pages or somewhere else) that we allow
>> explain/explain analyze for a command?
>>
>> Thoughts?
>
> Attaching v2 patch set reabsed on the latest master f7a1a805cb. And
> also added an entry for upcoming commitfest -
> https://commitfest.postgresql.org/32/2928/
>
> Please consider the v2 patches for further review.
>
Thanks for updating the patch!
+ /* Get the data generating query. */
+ dataQuery = get_matview_query(stmt, &matviewRel, &matviewOid);
- /*
- * Check for active uses of the relation in the current transaction, such
- * as open scans.
- *
- * NB: We count on this to protect us against problems with refreshing the
- * data using TABLE_INSERT_FROZEN.
- */
- CheckTableNotInUse(matviewRel, "REFRESH MATERIALIZED VIEW");
+ relowner = matviewRel->rd_rel->relowner;
After apply the patch, there is a duplicate
relowner = matviewRel->rd_rel->relowner;
+ else if(matviewInfo)
+ dest = CreateTransientRelDestReceiver(matviewInfo->OIDNewHeap);
If the `matviewInfo->OIDNewHeap` is invalid, IMO we don't need create
DestReceiver, isn't it? And we should add a space after `if`.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.Ltd.
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | japin <japinli(at)hotmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-01-08 09:24:50 |
Message-ID: | CALj2ACW0VaFsp2Z1V52J2JwHHeh+nTQRRHz+dWigBMLp1GXecA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Jan 8, 2021 at 1:50 PM japin <japinli(at)hotmail(dot)com> wrote:
> Thanks for updating the patch!
>
> + /* Get the data generating query. */
> + dataQuery = get_matview_query(stmt, &matviewRel, &matviewOid);
>
> - /*
> - * Check for active uses of the relation in the current transaction, such
> - * as open scans.
> - *
> - * NB: We count on this to protect us against problems with refreshing the
> - * data using TABLE_INSERT_FROZEN.
> - */
> - CheckTableNotInUse(matviewRel, "REFRESH MATERIALIZED VIEW");
> + relowner = matviewRel->rd_rel->relowner;
>
> After apply the patch, there is a duplicate
>
> relowner = matviewRel->rd_rel->relowner;
Corrected that.
> + else if(matviewInfo)
> + dest = CreateTransientRelDestReceiver(matviewInfo->OIDNewHeap);
>
> If the `matviewInfo->OIDNewHeap` is invalid, IMO we don't need create
> DestReceiver, isn't it? And we should add a space after `if`.
Yes, we can skip creating the dest receiver when OIDNewHeap is
invalid, this can happen for plain explain refresh mat view case.
if (explainInfo && !explainInfo->es->analyze)
OIDNewHeap = InvalidOid;
else
OIDNewHeap = get_new_heap_oid(stmt, matviewRel, matviewOid,
&relpersistence);
Since we don't call ExecutorRun for plain explain, we can skip the
dest receiver creation. I modified the code as below in explain.c.
if (into)
dest = CreateIntoRelDestReceiver(into);
else if (matviewInfo && OidIsValid(matviewInfo->OIDNewHeap))
dest = CreateTransientRelDestReceiver(matviewInfo->OIDNewHeap);
else
dest = None_Receiver;
Thanks for taking a look at the patches.
Attaching v3 patches, please consider these for further review.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v3-0001-Rearrange-Refresh-Mat-View-Code.patch | application/x-patch | 18.1 KB |
v3-0002-EXPLAIN-EXPLAIN-ANALYZE-REFRESH-MATERIALIZED-VIEW.patch | application/x-patch | 16.3 KB |
From: | japin <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-01-08 16:20:28 |
Message-ID: | MEYP282MB16698107786A45784694D989B6AE0@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, 08 Jan 2021 at 17:24, Bharath Rupireddy wrote:
> On Fri, Jan 8, 2021 at 1:50 PM japin <japinli(at)hotmail(dot)com> wrote:
>> Thanks for updating the patch!
>>
>> + /* Get the data generating query. */
>> + dataQuery = get_matview_query(stmt, &matviewRel, &matviewOid);
>>
>> - /*
>> - * Check for active uses of the relation in the current transaction, such
>> - * as open scans.
>> - *
>> - * NB: We count on this to protect us against problems with refreshing the
>> - * data using TABLE_INSERT_FROZEN.
>> - */
>> - CheckTableNotInUse(matviewRel, "REFRESH MATERIALIZED VIEW");
>> + relowner = matviewRel->rd_rel->relowner;
>>
>> After apply the patch, there is a duplicate
>>
>> relowner = matviewRel->rd_rel->relowner;
>
> Corrected that.
>
>> + else if(matviewInfo)
>> + dest = CreateTransientRelDestReceiver(matviewInfo->OIDNewHeap);
>>
>> If the `matviewInfo->OIDNewHeap` is invalid, IMO we don't need create
>> DestReceiver, isn't it? And we should add a space after `if`.
>
> Yes, we can skip creating the dest receiver when OIDNewHeap is
> invalid, this can happen for plain explain refresh mat view case.
>
> if (explainInfo && !explainInfo->es->analyze)
> OIDNewHeap = InvalidOid;
> else
> OIDNewHeap = get_new_heap_oid(stmt, matviewRel, matviewOid,
> &relpersistence);
>
> Since we don't call ExecutorRun for plain explain, we can skip the
> dest receiver creation. I modified the code as below in explain.c.
>
> if (into)
> dest = CreateIntoRelDestReceiver(into);
> else if (matviewInfo && OidIsValid(matviewInfo->OIDNewHeap))
> dest = CreateTransientRelDestReceiver(matviewInfo->OIDNewHeap);
> else
> dest = None_Receiver;
>
> Thanks for taking a look at the patches.
>
Thanks!
> Attaching v3 patches, please consider these for further review.
>
I find that both the declaration and definition of match_matview_with_new_data()
have a tab between type and variable. We can use pgindent to fix it.
What do you think?
static void
match_matview_with_new_data(RefreshMatViewStmt *stmt, Relation matviewRel,
^
Oid matviewOid, Oid OIDNewHeap, Oid relowner,
int save_sec_context, char relpersistence,
uint64 processed)
^
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | japin <japinli(at)hotmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-01-09 01:38:15 |
Message-ID: | CALj2ACXTQzEVhCO_dQ0JDPj=_vKf5NsSvLrPa9J1P13FiPEtwA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Jan 8, 2021 at 9:50 PM japin <japinli(at)hotmail(dot)com> wrote:
> > Attaching v3 patches, please consider these for further review.
> >
>
> I find that both the declaration and definition of match_matview_with_new_data()
> have a tab between type and variable. We can use pgindent to fix it.
> What do you think?
>
>
> static void
> match_matview_with_new_data(RefreshMatViewStmt *stmt, Relation matviewRel,
> ^
> Oid matviewOid, Oid OIDNewHeap, Oid relowner,
> int save_sec_context, char relpersistence,
> uint64 processed)
> ^
I ran pgindent on 0001 patch to fix the above. 0002 patch has no
changes. If I'm correct, pgindent will be run periodically on master.
Attaching v4 patch set for further review.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v4-0001-Rearrange-Refresh-Mat-View-Code.patch | application/octet-stream | 18.1 KB |
v4-0002-EXPLAIN-EXPLAIN-ANALYZE-REFRESH-MATERIALIZED-VIEW.patch | application/octet-stream | 16.3 KB |
From: | japin <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-01-09 02:02:46 |
Message-ID: | MEYP282MB166996BD30E922F182FDC452B6AD0@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sat, 09 Jan 2021 at 09:38, Bharath Rupireddy wrote:
> On Fri, Jan 8, 2021 at 9:50 PM japin <japinli(at)hotmail(dot)com> wrote:
>> > Attaching v3 patches, please consider these for further review.
>> >
>>
>> I find that both the declaration and definition of match_matview_with_new_data()
>> have a tab between type and variable. We can use pgindent to fix it.
>> What do you think?
>>
>>
>> static void
>> match_matview_with_new_data(RefreshMatViewStmt *stmt, Relation matviewRel,
>> ^
>> Oid matviewOid, Oid OIDNewHeap, Oid relowner,
>> int save_sec_context, char relpersistence,
>> uint64 processed)
>> ^
>
> I ran pgindent on 0001 patch to fix the above. 0002 patch has no
> changes. If I'm correct, pgindent will be run periodically on master.
>
Thanks for your point out. I don't know before.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | David Steele <david(at)pgmasters(dot)net> |
---|---|
To: | japin <japinli(at)hotmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-03 12:56:43 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi Japin,
On 1/8/21 9:02 PM, japin wrote:
>
> On Sat, 09 Jan 2021 at 09:38, Bharath Rupireddy wrote:
>> On Fri, Jan 8, 2021 at 9:50 PM japin <japinli(at)hotmail(dot)com> wrote:
>>
>> I ran pgindent on 0001 patch to fix the above. 0002 patch has no
>> changes. If I'm correct, pgindent will be run periodically on master.
>>
>
> Thanks for your point out. I don't know before.
Do you know if you will have time to review this patch during the
current commitfest?
Regards,
--
-David
david(at)pgmasters(dot)net
From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | David Steele <david(at)pgmasters(dot)net> |
Cc: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-04 06:10:58 |
Message-ID: | MEYP282MB16690768FCEC146CACF310DBB6979@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, 03 Mar 2021 at 20:56, David Steele <david(at)pgmasters(dot)net> wrote:
> Do you know if you will have time to review this patch during the
> current commitfest?
>
Sorry for the late reply! I think I have time to review this patch
and I will do it later.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Japin Li <japinli(at)hotmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-04 06:53:22 |
Message-ID: | CALj2ACUX72OBdM8sO=4knvPWZoEnuNcpQRNyy43jJUCkfuZj2Q@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Mar 4, 2021 at 11:41 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
> On Wed, 03 Mar 2021 at 20:56, David Steele <david(at)pgmasters(dot)net> wrote:
> > Do you know if you will have time to review this patch during the
> > current commitfest?
> >
>
> Sorry for the late reply! I think I have time to review this patch
> and I will do it later.
Thanks! I will look forward for more review comments.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-05 04:01:51 |
Message-ID: | MEYP282MB1669D626C58111E457A029FBB6969@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, 04 Mar 2021 at 14:53, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> Thanks! I will look forward for more review comments.
>
v4-0001-Rearrange-Refresh-Mat-View-Code.patch
---------------------------------------------
+static Oid
+get_new_heap_oid(RefreshMatViewStmt *stmt, Relation matviewRel, Oid matviewOid,
+ char *relpersistence)
+{
+ Oid OIDNewHeap;
+ bool concurrent;
+ Oid tableSpace;
+
+ concurrent = stmt->concurrent;
+
+ /* Concurrent refresh builds new data in temp tablespace, and does diff. */
+ if (concurrent)
+ {
+ tableSpace = GetDefaultTablespace(RELPERSISTENCE_TEMP, false);
+ *relpersistence = RELPERSISTENCE_TEMP;
+ }
Since the concurrent only use in one place, I think we can remove the local variable
concurrent in get_new_heap_oid().
The others looks good to me.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Japin Li <japinli(at)hotmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-05 11:48:45 |
Message-ID: | CALj2ACXtR4S2EW347F13_71k9ie2QwgZe0DS+Bg5nUGELKzgQg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, Mar 5, 2021 at 9:32 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
> On Thu, 04 Mar 2021 at 14:53, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > Thanks! I will look forward for more review comments.
> >
>
> v4-0001-Rearrange-Refresh-Mat-View-Code.patch
> ---------------------------------------------
>
> +static Oid
> +get_new_heap_oid(RefreshMatViewStmt *stmt, Relation matviewRel, Oid matviewOid,
> + char *relpersistence)
> +{
> + Oid OIDNewHeap;
> + bool concurrent;
> + Oid tableSpace;
> +
> + concurrent = stmt->concurrent;
> +
> + /* Concurrent refresh builds new data in temp tablespace, and does diff. */
> + if (concurrent)
> + {
> + tableSpace = GetDefaultTablespace(RELPERSISTENCE_TEMP, false);
> + *relpersistence = RELPERSISTENCE_TEMP;
> + }
>
> Since the concurrent only use in one place, I think we can remove the local variable
> concurrent in get_new_heap_oid().
Done.
> The others looks good to me.
Thanks.
Attaching v5 patch set for further review.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v5-0001-Rearrange-Refresh-Mat-View-Code.patch | application/x-patch | 18.0 KB |
v5-0002-EXPLAIN-EXPLAIN-ANALYZE-REFRESH-MATERIALIZED-VIEW.patch | application/x-patch | 16.3 KB |
From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-07 06:19:03 |
Message-ID: | MEYP282MB166929A83D892DA9A3AC3E9BB6949@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> Attaching v5 patch set for further review.
>
The v5 patch looks good to me, if there is no objection, I'll change the
cf status to "Ready for Committer" in few days.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Japin Li <japinli(at)hotmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-07 06:25:15 |
Message-ID: | CALj2ACX_9MaqvkZe_nBLHFzr04yRTV4XMuj-m+Ygcy1LDhQoag@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, Mar 7, 2021 at 11:49 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
>
> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > Attaching v5 patch set for further review.
> >
>
> The v5 patch looks good to me, if there is no objection, I'll change the
> cf status to "Ready for Committer" in few days.
Thanks for the review.
As I mentioned upthread, I have 2 open points:
1) In the patch I have added a new mat view info parameter to
ExplainOneQuery(), do we also need to add it to
ExplainOneQuery_hook_type? IMO, we should not (for now), because this
would create a backward compatibility issue.
2) Do we document (under respective command pages or somewhere else)
that we allow explain/explain analyze for a command?
Thoughts?
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-07 06:43:22 |
Message-ID: | MEYP282MB1669F2AB5D7866D0AEE6A72EB6949@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> On Sun, Mar 7, 2021 at 11:49 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
>>
>> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>> > Attaching v5 patch set for further review.
>> >
>>
>> The v5 patch looks good to me, if there is no objection, I'll change the
>> cf status to "Ready for Committer" in few days.
>
> Thanks for the review.
>
> As I mentioned upthread, I have 2 open points:
> 1) In the patch I have added a new mat view info parameter to
> ExplainOneQuery(), do we also need to add it to
> ExplainOneQuery_hook_type? IMO, we should not (for now), because this
> would create a backward compatibility issue.
Sorry, I do not know how PostgreSQL handle the backward compatibility issue.
Is there a guideline?
> 2) Do we document (under respective command pages or somewhere else)
> that we allow explain/explain analyze for a command?
>
IMO, we can add a new page to list the commands that can be explain/explain analyze,
since it's clear for users.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Japin Li <japinli(at)hotmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-07 09:33:43 |
Message-ID: | CALj2ACUM=oBDmDgH4YRXbWDmQu4YTwnG=5cS1=3z+8tgoJv05A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, Mar 7, 2021 at 12:13 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
>
> On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > On Sun, Mar 7, 2021 at 11:49 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
> >>
> >> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> >> > Attaching v5 patch set for further review.
> >> >
> >>
> >> The v5 patch looks good to me, if there is no objection, I'll change the
> >> cf status to "Ready for Committer" in few days.
> >
> > Thanks for the review.
> >
> > As I mentioned upthread, I have 2 open points:
> > 1) In the patch I have added a new mat view info parameter to
> > ExplainOneQuery(), do we also need to add it to
> > ExplainOneQuery_hook_type? IMO, we should not (for now), because this
> > would create a backward compatibility issue.
>
> Sorry, I do not know how PostgreSQL handle the backward compatibility issue.
> Is there a guideline?
I'm not aware of any guidelines as such, but we usually avoid any
changes to existing API, adding/making changes to system catalogs and
so on.
> > 2) Do we document (under respective command pages or somewhere else)
> > that we allow explain/explain analyze for a command?
> >
>
> IMO, we can add a new page to list the commands that can be explain/explain analyze,
> since it's clear for users.
We are listing all the supported commands in explain.sgml, so added
the CREATE MATERIALIZED VIEW(it's missing even though it's supported
prior to this patch) and REFRESH MATERIALIZED VIEW there.
Attaching v6 patch set. Please have a look.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v6-0001-Rearrange-Refresh-Mat-View-Code.patch | application/x-patch | 18.0 KB |
v6-0002-EXPLAIN-EXPLAIN-ANALYZE-REFRESH-MATERIALIZED-VIEW.patch | application/x-patch | 17.1 KB |
From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-07 12:07:15 |
Message-ID: | MEYP282MB1669A71623190A4939E2B9FBB6949@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, 07 Mar 2021 at 17:33, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> On Sun, Mar 7, 2021 at 12:13 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
>>
>> On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>> > On Sun, Mar 7, 2021 at 11:49 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
>> >>
>> >> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>> >> > Attaching v5 patch set for further review.
>> >> >
>> >>
>> >> The v5 patch looks good to me, if there is no objection, I'll change the
>> >> cf status to "Ready for Committer" in few days.
>> >
>> > Thanks for the review.
>> >
>> > As I mentioned upthread, I have 2 open points:
>> > 1) In the patch I have added a new mat view info parameter to
>> > ExplainOneQuery(), do we also need to add it to
>> > ExplainOneQuery_hook_type? IMO, we should not (for now), because this
>> > would create a backward compatibility issue.
>>
>> Sorry, I do not know how PostgreSQL handle the backward compatibility issue.
>> Is there a guideline?
>
> I'm not aware of any guidelines as such, but we usually avoid any
> changes to existing API, adding/making changes to system catalogs and
> so on.
>
Thanks for explaining, I'd be inclined keep it backward compatibility.
>> > 2) Do we document (under respective command pages or somewhere else)
>> > that we allow explain/explain analyze for a command?
>> >
>>
>> IMO, we can add a new page to list the commands that can be explain/explain analyze,
>> since it's clear for users.
>
> We are listing all the supported commands in explain.sgml, so added
> the CREATE MATERIALIZED VIEW(it's missing even though it's supported
> prior to this patch) and REFRESH MATERIALIZED VIEW there.
>
> Attaching v6 patch set. Please have a look.
>
LGTM.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | Japin Li <japinli(at)hotmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-07 16:45:33 |
Message-ID: | CALNJ-vSBzfNkvchtvzTcX5N0mbFzsEe4NFCQ2B41o_Zf8V=SPA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi,
+ * EXPLAIN ANALYZE CREATE TABLE AS or REFRESH MATERIALIZED VIEW
+ * WITH NO DATA is weird.
Maybe it is clearer to spell out WITH NO DATA for both statements, instead
of sharing it.
- if (!stmt->skipData)
+ if (!stmt->skipData && !explainInfo)
...
+ else if (explainInfo)
It would be cleaner to put the 'if (explainInfo)' as the first check. That
way, the check for skipData can be simplified.
Cheers
On Sun, Mar 7, 2021 at 1:34 AM Bharath Rupireddy <
bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> On Sun, Mar 7, 2021 at 12:13 PM Japin Li <japinli(at)hotmail(dot)com> wrote:
> >
> > On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy <
> bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > > On Sun, Mar 7, 2021 at 11:49 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
> > >>
> > >> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy <
> bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > >> > Attaching v5 patch set for further review.
> > >> >
> > >>
> > >> The v5 patch looks good to me, if there is no objection, I'll change
> the
> > >> cf status to "Ready for Committer" in few days.
> > >
> > > Thanks for the review.
> > >
> > > As I mentioned upthread, I have 2 open points:
> > > 1) In the patch I have added a new mat view info parameter to
> > > ExplainOneQuery(), do we also need to add it to
> > > ExplainOneQuery_hook_type? IMO, we should not (for now), because this
> > > would create a backward compatibility issue.
> >
> > Sorry, I do not know how PostgreSQL handle the backward compatibility
> issue.
> > Is there a guideline?
>
> I'm not aware of any guidelines as such, but we usually avoid any
> changes to existing API, adding/making changes to system catalogs and
> so on.
>
> > > 2) Do we document (under respective command pages or somewhere else)
> > > that we allow explain/explain analyze for a command?
> > >
> >
> > IMO, we can add a new page to list the commands that can be
> explain/explain analyze,
> > since it's clear for users.
>
> We are listing all the supported commands in explain.sgml, so added
> the CREATE MATERIALIZED VIEW(it's missing even though it's supported
> prior to this patch) and REFRESH MATERIALIZED VIEW there.
>
> Attaching v6 patch set. Please have a look.
>
> With Regards,
> Bharath Rupireddy.
> EnterpriseDB: http://www.enterprisedb.com
>
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Zhihong Yu <zyu(at)yugabyte(dot)com> |
Cc: | Japin Li <japinli(at)hotmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-08 04:28:56 |
Message-ID: | CALj2ACXJ8S3gK34_-508kCcM=Zw9gy0c0SR5usacrq+QdS+r0w@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, Mar 7, 2021 at 10:13 PM Zhihong Yu <zyu(at)yugabyte(dot)com> wrote:
> Hi,
>
> + * EXPLAIN ANALYZE CREATE TABLE AS or REFRESH MATERIALIZED VIEW
> + * WITH NO DATA is weird.
>
> Maybe it is clearer to spell out WITH NO DATA for both statements, instead of sharing it.
Done that way.
> - if (!stmt->skipData)
> + if (!stmt->skipData && !explainInfo)
> ...
> + else if (explainInfo)
>
> It would be cleaner to put the 'if (explainInfo)' as the first check. That way, the check for skipData can be simplified.
Changed.
Thanks for review comments. Attaching v7 patch set with changes only
in 0002 patch. Please have a look.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v7-0001-Rearrange-Refresh-Mat-View-Code.patch | application/octet-stream | 18.0 KB |
v7-0002-EXPLAIN-EXPLAIN-ANALYZE-REFRESH-MATERIALIZED-VIEW.patch | application/octet-stream | 17.1 KB |
From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | Zhihong Yu <zyu(at)yugabyte(dot)com>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-13 01:29:53 |
Message-ID: | MEYP282MB16691A9627683144BC01C869B66E9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, 08 Mar 2021 at 12:28, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> On Sun, Mar 7, 2021 at 10:13 PM Zhihong Yu <zyu(at)yugabyte(dot)com> wrote:
>> Hi,
>>
>> + * EXPLAIN ANALYZE CREATE TABLE AS or REFRESH MATERIALIZED VIEW
>> + * WITH NO DATA is weird.
>>
>> Maybe it is clearer to spell out WITH NO DATA for both statements, instead of sharing it.
>
> Done that way.
>
>> - if (!stmt->skipData)
>> + if (!stmt->skipData && !explainInfo)
>> ...
>> + else if (explainInfo)
>>
>> It would be cleaner to put the 'if (explainInfo)' as the first check. That way, the check for skipData can be simplified.
>
> Changed.
>
> Thanks for review comments. Attaching v7 patch set with changes only
> in 0002 patch. Please have a look.
>
The v7 patch looks good to me, and there is no other advice, so I change
the status to "Ready for Committer".
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Japin Li <japinli(at)hotmail(dot)com> |
Cc: | Zhihong Yu <zyu(at)yugabyte(dot)com>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-15 03:32:02 |
Message-ID: | CALj2ACV5qXtiiWP4Dk+f0fxe-6cE4-YMmivdViXM5Y9Nsj1YdQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sat, Mar 13, 2021 at 7:00 AM Japin Li <japinli(at)hotmail(dot)com> wrote:
>
> On Mon, 08 Mar 2021 at 12:28, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> > On Sun, Mar 7, 2021 at 10:13 PM Zhihong Yu <zyu(at)yugabyte(dot)com> wrote:
> >> Hi,
> >>
> >> + * EXPLAIN ANALYZE CREATE TABLE AS or REFRESH MATERIALIZED VIEW
> >> + * WITH NO DATA is weird.
> >>
> >> Maybe it is clearer to spell out WITH NO DATA for both statements, instead of sharing it.
> >
> > Done that way.
> >
> >> - if (!stmt->skipData)
> >> + if (!stmt->skipData && !explainInfo)
> >> ...
> >> + else if (explainInfo)
> >>
> >> It would be cleaner to put the 'if (explainInfo)' as the first check. That way, the check for skipData can be simplified.
> >
> > Changed.
> >
> > Thanks for review comments. Attaching v7 patch set with changes only
> > in 0002 patch. Please have a look.
> >
>
> The v7 patch looks good to me, and there is no other advice, so I change
> the status to "Ready for Committer".
Thanks for the review.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-15 19:45:38 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
[ Sorry for not looking at this thread sooner ]
Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> writes:
> Currently, $subject is not allowed. We do plan the mat view query
> before every refresh. I propose to show the explain/explain analyze of
> the select part of the mat view in case of Refresh Mat View(RMV).
TBH, I think we should reject this. The problem with it is that it
binds us to the assumption that REFRESH MATERIALIZED VIEW has an
explainable plan. There are various people poking at ideas like
incremental matview updates, which might rely on some implementation
that doesn't exactly equate to a SQL query. Incremental updates are
hard enough already; they'll be even harder if they also have to
maintain compatibility with a pre-existing EXPLAIN behavior.
I don't really see that this feature buys us anything you can't
get by explaining the view's query, so I think we're better advised
to keep our options open about how REFRESH might be implemented
in future.
regards, tom lane
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-16 12:13:03 |
Message-ID: | CALj2ACVXD6smGJ4gQWKdcnStTW3zwxZaRaukMa9rw+h9Y4FpHQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Mar 16, 2021 at 1:15 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> [ Sorry for not looking at this thread sooner ]
>
> Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> writes:
> > Currently, $subject is not allowed. We do plan the mat view query
> > before every refresh. I propose to show the explain/explain analyze of
> > the select part of the mat view in case of Refresh Mat View(RMV).
>
> TBH, I think we should reject this. The problem with it is that it
> binds us to the assumption that REFRESH MATERIALIZED VIEW has an
> explainable plan. There are various people poking at ideas like
> incremental matview updates, which might rely on some implementation
> that doesn't exactly equate to a SQL query. Incremental updates are
> hard enough already; they'll be even harder if they also have to
> maintain compatibility with a pre-existing EXPLAIN behavior.
>
> I don't really see that this feature buys us anything you can't
> get by explaining the view's query, so I think we're better advised
> to keep our options open about how REFRESH might be implemented
> in future.
That makes sense to me. Thanks for the comments. I'm fine to withdraw the patch.
I would like to see if the 0001 patch(attaching here) will be useful
at all. It just splits up the existing ExecRefreshMatView into a few
functions to make the code readable. I'm okay to withdraw it if no one
agrees.
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
v7-0001-Rearrange-Refresh-Mat-View-Code.patch | application/x-patch | 18.0 KB |
From: | Japin Li <japinli(at)hotmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-03-18 01:51:09 |
Message-ID: | MEYP282MB16695194861BD664AEC12A2EB6699@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, 16 Mar 2021 at 20:13, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
> On Tue, Mar 16, 2021 at 1:15 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>> [ Sorry for not looking at this thread sooner ]
>>
>> Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> writes:
>> > Currently, $subject is not allowed. We do plan the mat view query
>> > before every refresh. I propose to show the explain/explain analyze of
>> > the select part of the mat view in case of Refresh Mat View(RMV).
>>
>> TBH, I think we should reject this. The problem with it is that it
>> binds us to the assumption that REFRESH MATERIALIZED VIEW has an
>> explainable plan. There are various people poking at ideas like
>> incremental matview updates, which might rely on some implementation
>> that doesn't exactly equate to a SQL query. Incremental updates are
>> hard enough already; they'll be even harder if they also have to
>> maintain compatibility with a pre-existing EXPLAIN behavior.
>>
>> I don't really see that this feature buys us anything you can't
>> get by explaining the view's query, so I think we're better advised
>> to keep our options open about how REFRESH might be implemented
>> in future.
>
> That makes sense to me. Thanks for the comments. I'm fine to withdraw the patch.
>
> I would like to see if the 0001 patch(attaching here) will be useful
> at all. It just splits up the existing ExecRefreshMatView into a few
> functions to make the code readable.
+1.
--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.
From: | John Naylor <john(dot)naylor(at)enterprisedb(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-07-10 11:49:08 |
Message-ID: | CAFBsxsGf=9OpSWZZrV1UBCEEDKAAjdxKkQbBE_Gm2d+9xPsDaQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Tue, Mar 16, 2021 at 8:13 AM Bharath Rupireddy <
bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Tue, Mar 16, 2021 at 1:15 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > I don't really see that this feature buys us anything you can't
> > get by explaining the view's query, so I think we're better advised
> > to keep our options open about how REFRESH might be implemented
> > in future.
>
> That makes sense to me. Thanks for the comments. I'm fine to withdraw the
patch.
>
> I would like to see if the 0001 patch(attaching here) will be useful
> at all. It just splits up the existing ExecRefreshMatView into a few
> functions to make the code readable. I'm okay to withdraw it if no one
> agrees.
Side note for future reference: While the feature named in the CF entry has
been rejected, the remaining 0001 patch currently proposed no longer
matches the title, or category. It is possible within the CF app, and
helpful, to rename the entry when the scope changes.
The proposed patch in the CF for incremental view maintenance [1] does some
refactoring of its own in implementing the feature. I don't think it makes
sense to commit a refactoring that conflicts with that, while not
necessarily making life easier for that feature. Incremental view
maintenance is highly desirable, so I don't want to put up unnecessary
roadblocks.
[1] https://commitfest.postgresql.org/33/2138/
--
John Naylor
EDB: http://www.enterprisedb.com
From: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
---|---|
To: | John Naylor <john(dot)naylor(at)enterprisedb(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW |
Date: | 2021-07-10 13:23:50 |
Message-ID: | CALj2ACURBP=ENmgskuxDS61V5x8zotwJ55ak2VmOWLJZGedOPA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sat, Jul 10, 2021 at 5:19 PM John Naylor
<john(dot)naylor(at)enterprisedb(dot)com> wrote:
> Side note for future reference: While the feature named in the CF entry has been rejected, the remaining 0001 patch currently proposed no longer matches the title, or category. It is possible within the CF app, and helpful, to rename the entry when the scope changes.
>
> The proposed patch in the CF for incremental view maintenance [1] does some refactoring of its own in implementing the feature. I don't think it makes sense to commit a refactoring that conflicts with that, while not necessarily making life easier for that feature. Incremental view maintenance is highly desirable, so I don't want to put up unnecessary roadblocks.
Thanks. I'm okay to close the CF
entry(https://commitfest.postgresql.org/33/2928/) and stop this
thread.
Regards,
Bharath Rupireddy.