Re: What is the best way to optimize the query.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Srikanth <srikanth(at)inventum(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: What is the best way to optimize the query.
Date: 2010-07-27 18:11:27
Message-ID: AANLkTinh4d6+0t9=0on28O_2eqSx+y=UNZX9iiptjAX6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sat, Jul 17, 2010 at 4:50 AM, Srikanth <srikanth(at)inventum(dot)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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Whit Armstrong 2010-07-27 18:20:20 Re: Linux Filesystems again - Ubuntu this time
Previous Message Kevin Grittner 2010-07-27 17:19:27 Re: Linux Filesystems again - Ubuntu this time