Re: ORDER BY in materialized view example?

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Maciek Sakrejda <m(dot)sakrejda(at)gmail(dot)com>, pgsql-docs(at)postgresql(dot)org
Subject: Re: ORDER BY in materialized view example?
Date: 2021-11-23 16:06:32
Message-ID: 1e9f99f9-9cdb-4bc3-85d9-c017fbc54566@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 23.11.21 07:18, Maciek Sakrejda wrote:
> An example in the materialized view documentation [1] includes an ORDER
> BY clause without a clear reason. Does it help build the index more
> efficiently? I suppose it's also sort of like a CLUSTER?
>
> But it seems like the ORDER BY should either be explained or dropped: as
> is, this gives the impression that the ORDER BY can be "embedded" into
> the resulting relation and persist to other queries that do not include
> an explicit ORDER BY. (I recently ran across this belief, though not
> sure if this was due to this example.)
>
> Thoughts?
>
> [1]:
> https://www.postgresql.org/docs/current/rules-materializedviews.html
> <https://www.postgresql.org/docs/current/rules-materializedviews.html>

I agree the ORDER BY is not relevant to the example. There might be
some implementation-dependent advantage to ordering a materialized view,
but if there is, it isn't explained in the example.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2021-11-23 17:44:56 Re: ORDER BY in materialized view example?
Previous Message Alvaro Herrera 2021-11-23 14:21:05 Re: max_slot_wal_keep_size unit is not specified