Re: Skip Orderby Execution for Materialized Views

2023-10-01 Thread David G. Johnston
On Sun, Oct 1, 2023 at 8:57 AM Zhang Mingli wrote: > And if it’s true, shall we skip the order by clause for Materialized > View when executing create/refresh statement? > We tend to do precisely what the user writes into their query. If they don't want an order by they can remove it. I

Re: Skip Orderby Execution for Materialized Views

2023-10-01 Thread Zhang Mingli
HI, > On Oct 1, 2023, at 22:54, Tom Lane wrote: > > For one example, > you can't just remove the sort clause if the query uses DISTINCT ON Hi, Tom, got it, thanks, Zhang Mingli HashData https://www.hashdata.xyz

Re: Skip Orderby Execution for Materialized Views

2023-10-01 Thread Tom Lane
Zhang Mingli writes: > When create  or refresh a Materialized View, if the view’s query has order > by, we may sort and insert the sorted data into view. Indeed. > And if it’s true, shall we skip the order by clause for Materialized View   > when executing create/refresh statement? No. The

Skip Orderby Execution for Materialized Views

2023-10-01 Thread Zhang Mingli
Hi, all When create  or refresh a Materialized View, if the view’s query has order by, we may sort and insert the sorted data into view. Create Materialized View mv1 as select c1, c2 from t1 order by c2; Refresh Materialized View mv1; And it appears that we could get ordered