Re: Lazy View's Column Computing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Avi Weinberg <AviW(at)gilat(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Lazy View's Column Computing
Date: 2021-08-02 14:23:16
Message-ID: 1626111.1627914196@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Avi Weinberg <AviW(at)gilat(dot)com> writes:
> Is there a way to compute a column in a view only if it is referenced in the query? I have a view's column that its value is computed by a function. If in the query that column is not used at all, can Postgres "skip" computing it?

If the function is not volatile, and you're using a moderately recent PG
version, I'd expect the planner to do that for you.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vijaykumar Jain 2021-08-02 14:57:04 Re: Lazy View's Column Computing
Previous Message Avi Weinberg 2021-08-02 14:12:38 Lazy View's Column Computing