How come index isn't being used when query by function return value? - Mailing list pgsql-general

From Joseph Shraibman
Subject How come index isn't being used when query by function return value?
Date
Msg-id e96bql$blk$1@news.hub.org
Whole thread Raw
Responses Re: How come index isn't being used when query by function return value?  ("Merlin Moncure" <mmoncure@gmail.com>)
List pgsql-general
db:db=>explain select * from elog where id = eds('2006-01-01');
                                         QUERY PLAN
-------------------------------------------------------------------------------------------
  Seq Scan on elog  (cost=0.00..1894975.10 rows=1 width=204)
    Filter: (id = eds('2006-01-01 00:00:00'::timestamp without time zone))
(2 rows)

db:db=>explain select * from elog, (select eds('2006-01-01') as trg) aa
where id = trg;
                                       QUERY PLAN
--------------------------------------------------------------------------------------
  Nested Loop  (cost=0.00..4.36 rows=1 width=208)
    ->  Subquery Scan aa  (cost=0.00..0.02 rows=1 width=4)
          ->  Result  (cost=0.00..0.01 rows=1 width=0)
    ->  Index Scan using elog_pkey on elog  (cost=0.00..4.33 rows=1
width=204)
          Index Cond: (elog.id = "outer".trg)
(5 rows)

Time: 0.978 ms
db:db=>select version();
                                                  version
----------------------------------------------------------------------------------------------------------
  PostgreSQL 8.0.8 on x86_64-unknown-linux-gnu, compiled by GCC gcc
(GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
(1 row)


pgsql-general by date:

Previous
From: lanczos@t-zones.sk
Date:
Subject: Re: =???UTF-8?Q?re: How to insert .xls...
Next
From: "Merlin Moncure"
Date:
Subject: Re: How come index isn't being used when query by function return value?