Re: Baffled by failure to use index when WHERE uses a

From: Clive Page <cgp(at)star(dot)le(dot)ac(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Baffled by failure to use index when WHERE uses a
Date: 2006-03-10 14:04:26
Message-ID: Pine.LNX.4.63.0603101400120.2430@peneca.star.le.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 10 Mar 2006, Martijn van Oosterhout wrote:

> You don't describe the exact structure of your table nor the exact
> declaraion of your function, but is it possible your function is marked
> VOLATILE rather tha STABLE or IMMUTABLE?

Thanks for that hint - my function was not marked in any way, so I guess
it
got to be VOLATILE by default. I have just marked it as IMMUTABLE and it
now uses the index as expected, with a huge performance gain. I confess
that I was totally ignorant of the differences between these three types
of function.

Sorry I slightly messed up the cut/paste of my posting, I had been
experimenting with various versions of the same table and didn't quite get
the details consistent in what I posted.

Thanks also to Richard Huxton and Martin van Oosterhout who gave me the
same hint.

What an excellent support group this is.

--
Clive Page
Dept of Physics & Astronomy,
University of Leicester,
Leicester, LE1 7RH, U.K.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Emi Lu 2006-03-10 14:36:16 in Pl/PgSQL, do commit every 5000 records
Previous Message Richard Huxton 2006-03-10 10:36:19 Re: PL/pgSQL question