pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jonathan Bartlett <johnnyb@eskimo.com>
Cc: Elielson Fontanezi <ElielsonF@prodam.sp.gov.br>
Cc: 'Stephan Szabo' <sszabo@megazone.bigpanda.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Function index qeustion
Date: Fri, 25 Jul 2003 19:41:53 -0400
Message-ID: <9914.1059176513@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.GSU.4.44.0307251325080.14162-100000@eskimo.com>
References: <Pine.GSU.4.44.0307251325080.14162-100000@eskimo.com>

Jonathan Bartlett <johnnyb@eskimo.com> writes:
> 1) If you have an index on a cacheable function, does PostgreSQL use the
> index instead of calculating the results?

Not in general --- only for an indexscan lookup.

> 2) How does PostgreSQL know when to recompute the function?

Never.  That's what the iscachable flag means: you are promising that
the function's output for given input never changes.  If you aren't
prepared to make that promise, you cannot index the function.

			regards, tom lane



view thread (2+ messages)

Message-ID: <9914.1059176513@sss.pgh.pa.us>
Permalink:  ../9914.1059176513@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9914.1059176513@sss.pgh.pa.us

 · 

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, johnnyb@eskimo.com, ElielsonF@prodam.sp.gov.br, sszabo@megazone.bigpanda.com, pgsql-general@postgresql.org
  Subject: Re: Function index qeustion
  In-Reply-To: <9914.1059176513@sss.pgh.pa.us>

* 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