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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

BUG #2126: Index usage for function value



The following bug has been logged online:

Bug reference:      2126
Logged by:          Grzegorz TaÅ?czyk
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.



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group