Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 8545D1337BDD for ; Wed, 23 Mar 2011 10:10:52 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 09074-06 for ; Wed, 23 Mar 2011 13:10:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.cisx.com (failover.mail.cisx.com [78.41.6.83]) by mail.postgresql.org (Postfix) with ESMTP id 4D4B51337BDB for ; Wed, 23 Mar 2011 10:10:34 -0300 (ADT) Received: from DEVELOP1 ([192.168.100.50]) by mail.cisx.com (8.13.1/8.13.1) with SMTP id p2NDASvw012326 for ; Wed, 23 Mar 2011 13:10:34 GMT Message-ID: <479C9845FAF74274970CEF781EB9EF56@DEVELOP1> From: "Donald Fraser" To: "[BUGS]" Subject: Re: Index Ignored Due To Use Of View Date: Wed, 23 Mar 2011 13:10:28 -0000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0032_01CBE95B.AE36BDF0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5843 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.413 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FAKE_REPLY_C=1.486, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201103/293 X-Sequence-Number: 29803 This is a multi-part message in MIME format. ------=_NextPart_000_0032_01CBE95B.AE36BDF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable ----- Original Message -----=20 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.=20 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 ------=_NextPart_000_0032_01CBE95B.AE36BDF0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
----- Original Message -----
Sent: Wednesday, March 23, 2011 = 12:50=20 PM
Subject: Index Ignored Due To = Use Of=20 View

PostgreSQL 8.3.14
OS: Linux Redhat 5.4
 
Note: I have used the same subject for this email = taken from=20 an email: Posted 2011-02-24 13:29:22-08 by "David Johnston", because = this=20 seems to be a very similar observation.
 
Bug/Problem Summary:
We are using a simple query based on a simple view = and the=20 query optimizer is not choosing an index.
The same query without the view is using an=20 index.
The same query on an almost identical view, but = having=20 either removed a single column which was generated via a function call = or=20 replace the function call with equivalent SQL, then the = query=20 optimizer is choosing an index.
 
I found the solution to the problem and it would = therefore=20 appear as though this is not a bug!
If I change the function definition to be "STABLE" = instead of=20 "VOLATILE", then the problem goes away.
 
Regards
Donald = Fraser
------=_NextPart_000_0032_01CBE95B.AE36BDF0--