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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 17, 2010 at 4:50 AM, Srikanth <srikanth@xxxxxxxxxxxx> 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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux