Re: [GENERAL] Materialized view vs. view - Mailing list pgsql-general

From David G. Johnston
Subject Re: [GENERAL] Materialized view vs. view
Date
Msg-id CAKFQuwbNB8CxvZsS8n=Bsb1bfeoLWgKZr=FrDeu9-fT1C7wcaQ@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Materialized view vs. view  (Job <Job@colliniconsulting.it>)
List pgsql-general
On Tue, Jan 10, 2017 at 11:27 AM, Job <Job@colliniconsulting.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.

pgsql-general by date:

Previous
From: Melvin Davidson
Date:
Subject: Re: [GENERAL] i got a process holding the lock
Next
From: Melvin Davidson
Date:
Subject: Re: [GENERAL] Materialized view vs. view