pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Maciek Sakrejda <m.sakrejda@gmail.com>
To: pgsql-docs@postgresql.org
Subject: Re: ORDER BY in materialized view example?
Date: Tue, 23 Nov 2021 17:06:32 +0100
Message-ID: <1e9f99f9-9cdb-4bc3-85d9-c017fbc54566@enterprisedb.com> (raw)
In-Reply-To: <CAOtHd0D-OvrUU0C=4hX28p4BaSE1XL78BAQ0VcDaLLt8tdUzsg@mail.gmail.com>
References: <CAOtHd0D-OvrUU0C=4hX28p4BaSE1XL78BAQ0VcDaLLt8tdUzsg@mail.gmail.com>

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.





view thread (6+ messages)  latest in thread

Message-ID: <1e9f99f9-9cdb-4bc3-85d9-c017fbc54566@enterprisedb.com>
Permalink:  ../1e9f99f9-9cdb-4bc3-85d9-c017fbc54566@enterprisedb.com/
Also on:    postgresql.org/message-id/1e9f99f9-9cdb-4bc3-85d9-c017fbc54566@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, m.sakrejda@gmail.com
  Subject: Re: ORDER BY in materialized view example?
  In-Reply-To: <1e9f99f9-9cdb-4bc3-85d9-c017fbc54566@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox