Re: [Question] Window Function Results without ORDER BY Clause

Поиск
Список
Период
Сортировка
От Zhang Mingli
Тема Re: [Question] Window Function Results without ORDER BY Clause
Дата
Msg-id dca6fd49-5408-499e-b2b5-ad4d08fb6b5c@Spark
обсуждение исходный текст
Ответ на Re: [Question] Window Function Results without ORDER BY Clause  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers

On Jul 11, 2025 at 23:57 +0800, Tom Lane <tgl@sss.pgh.pa.us>, wrote:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
On Friday, July 11, 2025, Zhang Mingli <zmlpostgres@gmail.com> wrote:
So, are both result sets technically correct given the absence of an ORDER
BY clause?

The system is behaving within the requirements of the specification. The
query itself is bugged code that the query author should fix.

Well, it's our own regression-test query. I think the actual question
being asked here is "do our regression tests need to pass under random
non-default GUC settings?". I'd say no; it'd be next door to
impossible to guarantee that.
Hi, I didn't mean to imply that our regression tests should pass under random non-default GUC settings.
My concern arose from the development of our distributed databases, such as Greenplum and Apache Cloudberry.
In Postgres, the tuple order remains stable under constant GUC settings(Index Scan, SeqScan and there is no Parallel Seqscan for Window Agg). 
However, in a distributed environment, tuples are spread across segments, and the order in which data is returned to the Master node can be unpredictable. 
This unpredictability can affect the stability of results when calculating window functions.
I just wanted to confirm that both results are correct in the absence of an "ORDER BY" clause. I believe I've received the clarification I needed.
Thank you all!

--
Zhang Mingli
HashData

В списке pgsql-hackers по дате отправления: