Re: What is the best way to optimize the query. - Mailing list pgsql-performance

From Robert Haas
Subject Re: What is the best way to optimize the query.
Date
Msg-id AANLkTinh4d6+0t9=0on28O_2eqSx+y=UNZX9iiptjAX6@mail.gmail.com
Whole thread Raw
In response to What is the best way to optimize the query.  (Srikanth <srikanth@inventum.net>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Linux Filesystems again - Ubuntu this time
Next
From: Whit Armstrong
Date:
Subject: Re: Linux Filesystems again - Ubuntu this time