Re: Materialized view vs. view

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Job <Job(at)colliniconsulting(dot)it>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Materialized view vs. view
Date: 2017-01-10 18:42:57
Message-ID: CAKFQuwbNB8CxvZsS8n=Bsb1bfeoLWgKZr=FrDeu9-fT1C7wcaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 10, 2017 at 11:27 AM, Job <Job(at)colliniconsulting(dot)it> wrote:

> Hi guys,
>
> i am making some tests with a massive number of "select" queries (only
> for reading datas) on a view and a materialized view.
> We use Postgresql 9.6.1 on a 64bit server.
>
> Only for "select" queries, which one is faster and less expensive as
> resources cost?
> The view or the materialized view?
>
> The view has about 500K lines.
>
>
There is no simple answer to this - it all depends upon your actual usage.
With proper indexes and a disregard for the "REFRESH MATERIALIZED VIEW ..."
command cost the materialized view should always perform better. But most
people don't get to disregard the refresh dynamic imposed by materialized
views.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2017-01-10 18:44:12 Re: Materialized view vs. view
Previous Message Melvin Davidson 2017-01-10 18:39:30 Re: i got a process holding the lock