From: Donald Fraser <postgres@kiwi-fraser.net>
To: [BUGS] <pgsql-bugs@postgresql.org>
Subject: Re: Index Ignored Due To Use Of View
Date: Wed, 23 Mar 2011 13:10:28 -0000
Message-ID: <479C9845FAF74274970CEF781EB9EF56@DEVELOP1> (raw)
----- Original Message -----
Sent: Wednesday, March 23, 2011 12:50 PM
Subject: Index Ignored Due To Use Of View
PostgreSQL 8.3.14
OS: Linux Redhat 5.4
Note: I have used the same subject for this email taken from an email: Posted 2011-02-24 13:29:22-08 by "David Johnston", because this seems to be a very similar observation.
Bug/Problem Summary:
We are using a simple query based on a simple view and the query optimizer is not choosing an index.
The same query without the view is using an index.
The same query on an almost identical view, but having either removed a single column which was generated via a function call or replace the function call with equivalent SQL, then the query optimizer is choosing an index.
I found the solution to the problem and it would therefore appear as though this is not a bug!
If I change the function definition to be "STABLE" instead of "VOLATILE", then the problem goes away.
Regards
Donald Fraser
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: postgres@kiwi-fraser.net
Subject: Re: Index Ignored Due To Use Of View
In-Reply-To: <479C9845FAF74274970CEF781EB9EF56@DEVELOP1>
References: <479C9845FAF74274970CEF781EB9EF56@DEVELOP1>
* 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