Postgres not using index on views

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rick Vincent <rvincent(at)temenos(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>, Manoj Kumar <manojkumar(at)temenos(dot)com>, Herve Aubert <haubert(at)temenos(dot)com>
Subject: Postgres not using index on views
Date: 2020-04-17 14:55:29
Message-ID: CAKFQuwa4OiNpgZ9brTCh1dsM-asK2mMY+Wm6xOE6_gM5UngQ0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Friday, April 17, 2020, Rick Vincent <rvincent(at)temenos(dot)com> wrote:

> Hi,
>
> I was wondering if anyone can explain the below problem. Should a bug be
> logged for this?
>
> Kind regards,
> Rick
>
> _____________________________________________
> *From:* Rick Vincent
> *Sent:* Tuesday, April 7, 2020 11:08 AM
> *To:* 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>; Justin Pryzby <pryzby(at)telsasoft(dot)com>
> *Cc:* pgsql-performance(at)postgresql(dot)org; Manoj Kumar <
> manojkumar(at)temenos(dot)com>; Herve Aubert <haubert(at)temenos(dot)com>
> *Subject:* RE: Postgres not using index on views
>
>
> Hi Tom,
>
> The function is defined as below, so no use of VOLATILE. Let me know if
> you need any other information. I am hoping the below will further clarify
> the issue.
>
>

IIUC as Tom wrote you have volatile functions (implied/default as Thomas
wrote) attached to view column outputs and the planner will not optimize
those away.

Mark your function immutable (assuming it is) and retry your experiment
with the where clause query.

David J.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Rick Vincent 2020-04-17 15:12:14 RE: Postgres not using index on views
Previous Message Rick Vincent 2020-04-17 14:28:02 RE: Postgres not using index on views