Index selection bug

From: Andriy I Pilipenko <bamby(at)marka(dot)net(dot)ua>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Index selection bug
Date: 2000-07-26 06:24:49
Message-ID: Pine.BSF.4.21.0007260917440.51996-100000@bamby.marka.net.ua
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Andriy I Pilipenko
Your email address : bamby(at)marka(dot)net(dot)ua

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : FreeBSD 3.x

PostgreSQL version (example: PostgreSQL-7.0): PostgreSQL-7.0.2

Compiler used (example: gcc 2.8.0) : gcc 2.7.2.3

Please enter a FULL description of your problem:
------------------------------------------------

PostgreSQL refuses to use index if WHERE clause contains function call.
This problem exists in 6.5.3 also.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

Do following queries:

create table t (f int);

create index i on t (f);

create function func() returns int as 'select 1' language 'sql';

set enable_seqscan to 'off';

explain select * from t where f = 1;

Index Scan using i on t (cost=0.00..2.01 rows=1 width=4)

explain select * from t where f = func();

Seq Scan on t (cost=100000000.00..100000001.34 rows=1 width=4)

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-07-26 14:27:21 Re: Index selection bug
Previous Message Tom Lane 2000-07-25 23:30:39 Re: [SQL] Index selection on a large table