Skip site navigation (1) Skip section navigation (2)

BUG #2126: Index usage for function value

From: "Grzegorz Taczyk" <goliatus(at)polzone(dot)pl>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2126: Index usage for function value
Date: 2005-12-25 14:54:10
Message-ID: 20051225145410.DF2C9F0AC8@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      2126
Logged by:          Grzegorz Taczyk
Email address:      goliatus(at)polzone(dot)pl
PostgreSQL version: 8.1
Operating system:   Slackware
Description:        Index usage for function value
Details: 

SELECT * FROM table WHERE id = myfunction('x', 10);

There is an index created on id column, but query planner doesn't use it.

When I explain this query:
SELECT * FROM table WHERE id = (SELECT myfunction('x', 10))
Then index is used and execution is much faster.

Is this subquery nessesary?

It doesn't happen in all circumstances, but when query is more complex and
table is big then it happens.

Responses

pgsql-bugs by date

Next:From: Kyril AlyoshinDate: 2005-12-25 20:35:49
Subject: BUG #2127: Regular Expression Limits Do Not Work
Previous:From: Tatsuo IshiiDate: 2005-12-25 09:50:01
Subject: Re: [BUGS] BUG #2120: Crash when doing UTF8<->ISO_8859_8

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group