From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Zhang Mingli <zmlpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Skip Orderby Execution for Materialized Views |
Date: | 2023-10-01 14:54:46 |
Message-ID: | 1719350.1696172086@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Zhang Mingli <zmlpostgres(at)gmail(dot)com> 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 intent of a materialized view is to execute the query
as presented. If the user doesn't understand the consequences
of that, it's not our job to think we are smarter than they are.
I think this patch should be rejected.
BTW, I'm pretty certain that this patch breaks some valid cases
even if we take your point of view as correct. For one example,
you can't just remove the sort clause if the query uses DISTINCT ON.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2023-10-01 14:55:33 | Re: Regression in COPY FROM caused by 9f8377f7a2 |
Previous Message | Zhang Mingli | 2023-10-01 14:44:07 | Skip Orderby Execution for Materialized Views |