On Sat, Jul 17, 2010 at 4:50 AM, Srikanth <srikanth@inventum.net> wrote:
> I am sending u the query along with execution plan. Please help
Looks to me like your biggest problem is right here:
" -> Seq Scan
on subs s (cost=0.00..5599.42 rows=58313 width=69) (actual
time=409.370..153354.835 rows=146954 loops=1)"
" Filter:
(CASE WHEN ((status = 0) AND issubsexpired(subsno)) THEN 15 ELSE
status END <= 15)"
1ms/row is pretty slow, so I'm guessing that the issubsexpired()
function is not too speedy.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company