Re: Order of rows in simple "select r from table_fn()" - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Order of rows in simple "select r from table_fn()"
Date
Msg-id CAFj8pRAWmh5Xz8X8aoKO87_JSbN-UM_mjj92x+5yveSBxms6SQ@mail.gmail.com
Whole thread Raw
In response to Order of rows in simple "select r from table_fn()"  (Bryn Llewellyn <bryn@yugabyte.com>)
List pgsql-general
Hi
 
It adds an uncomfortable amount of clutter.

* Is it essential for correctness? *

It's annoying that the use of "return next" prevents the pattern that each "print line" follows from being encapsulated into a procedure. But it is what it is, yes?

RETURN NEXT, RETURN QUERY (RETURN QUERY is +/- RETURN NEXT) materializes result in tuple store. This can be a source of performance problems sometimes (SELECT * FROM fc() LIMIT n) , but you can believe in persistent order. Order of reading from the tuple store is exactly like reading from a file, and there are not any other processes that can modify the order of reading (tuple store is not visible from other processes). I can imagine different mechanisms in the future - without materialization based on pipes - but it is a very far future, and still there will not be a reason for change of order.

Regards

Pavel




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Query plan for "id IS NULL" on PK
Next
From: Bryn Llewellyn
Date:
Subject: Re: Order of rows in simple "select r from table_fn()"