Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-07-10 Thread Bharath Rupireddy
On Sat, Jul 10, 2021 at 5:19 PM John Naylor 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-07-10 Thread John Naylor
On Tue, Mar 16, 2021 at 8:13 AM Bharath Rupireddy < bharath.rupireddyforpostg...@gmail.com> wrote: > > On Tue, Mar 16, 2021 at 1:15 AM Tom Lane 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 > >

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-17 Thread Japin Li
On Tue, 16 Mar 2021 at 20:13, Bharath Rupireddy wrote: > On Tue, Mar 16, 2021 at 1:15 AM Tom Lane wrote: >> >> [ Sorry for not looking at this thread sooner ] >> >> Bharath Rupireddy writes: >> > Currently, $subject is not allowed. We do plan the mat view query >> > before every refresh. I

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-16 Thread Bharath Rupireddy
On Tue, Mar 16, 2021 at 1:15 AM Tom Lane wrote: > > [ Sorry for not looking at this thread sooner ] > > Bharath Rupireddy 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-15 Thread Tom Lane
[ Sorry for not looking at this thread sooner ] Bharath Rupireddy 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-14 Thread Bharath Rupireddy
On Sat, Mar 13, 2021 at 7:00 AM Japin Li wrote: > > On Mon, 08 Mar 2021 at 12:28, Bharath Rupireddy > wrote: > > On Sun, Mar 7, 2021 at 10:13 PM Zhihong Yu wrote: > >> Hi, > >> > >> +* EXPLAIN ANALYZE CREATE TABLE AS or REFRESH MATERIALIZED VIEW > >> +* WITH NO DATA is weird. >

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-12 Thread Japin Li
On Mon, 08 Mar 2021 at 12:28, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 10:13 PM Zhihong Yu 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-07 Thread Bharath Rupireddy
On Sun, Mar 7, 2021 at 10:13 PM Zhihong Yu 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-07 Thread Zhihong Yu
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)

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-07 Thread Japin Li
On Sun, 07 Mar 2021 at 17:33, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 12:13 PM Japin Li wrote: >> >> On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy >> wrote: >> > On Sun, Mar 7, 2021 at 11:49 AM Japin Li wrote: >> >> >> >> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy >> >>

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-07 Thread Bharath Rupireddy
and PREPARE.) + */ +static Query * +rewrite_refresh_matview_query(Query *dataQuery) +{ + List *rewritten; + Query *copied_query; + + /* Lock and rewrite, using a copy to preserve the original query. */ + copied_query = copyObject(dataQuery); + AcquireRewriteLocks(copied_query, true, false);

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-06 Thread Japin Li
On Sun, 07 Mar 2021 at 14:25, Bharath Rupireddy wrote: > On Sun, Mar 7, 2021 at 11:49 AM Japin Li wrote: >> >> On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy >> wrote: >> > Attaching v5 patch set for further review. >> > >> >> The v5 patch looks good to me, if there is no objection, I'll

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-06 Thread Bharath Rupireddy
On Sun, Mar 7, 2021 at 11:49 AM Japin Li wrote: > > On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy > 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-06 Thread Japin Li
On Fri, 05 Mar 2021 at 19:48, Bharath Rupireddy 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.

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-05 Thread Bharath Rupireddy
RIALIZED VIEW is in a portal or plpgsql function and is executed + * repeatedly. (See also the same hack in EXPLAIN and PREPARE.) + */ +static Query * +rewrite_refresh_matview_query(Query *dataQuery) +{ + List *rewritten; + Query *copied_query; + + /* Lock and rewrite, using a copy to prese

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-04 Thread Japin Li
On Thu, 04 Mar 2021 at 14:53, Bharath Rupireddy 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-03 Thread Bharath Rupireddy
On Thu, Mar 4, 2021 at 11:41 AM Japin Li wrote: > On Wed, 03 Mar 2021 at 20:56, David Steele 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.

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-03 Thread Japin Li
On Wed, 03 Mar 2021 at 20:56, David Steele 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-03-03 Thread David Steele
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 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread japin
On Sat, 09 Jan 2021 at 09:38, Bharath Rupireddy wrote: > On Fri, Jan 8, 2021 at 9:50 PM japin 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread Bharath Rupireddy
On Fri, Jan 8, 2021 at 9:50 PM japin 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?

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread japin
On Fri, 08 Jan 2021 at 17:24, Bharath Rupireddy wrote: > On Fri, Jan 8, 2021 at 1:50 PM japin wrote: >> Thanks for updating the patch! >> >> + /* Get the data generating query. */ >> + dataQuery = get_matview_query(stmt, , ); >> >> - /* >> -* Check for active uses of

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread Bharath Rupireddy
_refresh_matview_query(Query *dataQuery) +{ + List *rewritten; + Query *copied_query; + + /* Lock and rewrite, using a copy to preserve the original query. */ + copied_query = copyObject(dataQuery); + AcquireRewriteLocks(copied_query, true, false); + rewritten = QueryRewrite(copied_query);

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-08 Thread japin
gt;> > >> > 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

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2021-01-07 Thread Bharath Rupireddy
de - 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. >

Re: EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2020-12-28 Thread Bharath Rupireddy
his 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

EXPLAIN/EXPLAIN ANALYZE REFRESH MATERIALIZED VIEW

2020-12-22 Thread Bharath Rupireddy
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