Re: bad plan

From: Richard Huxton <dev(at)archonet(dot)com>
To: Gaetano Mendola <mendola(at)bigfoot(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: bad plan
Date: 2005-03-08 11:39:58
Message-ID: 422D8F0E.8000906@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Gaetano Mendola wrote:
> running a 7.4.5 engine, I'm facing this bad plan:
>
> empdb=# explain analyze SELECT name,url,descr,request_status,url_status,size_mb,estimated_start,request_time_stamp
> empdb-# FROM v_sc_user_request
> empdb-# WHERE
> empdb-# login = 'babinow1'
> empdb-# LIMIT 10 ;

> -> Subquery Scan vsp (cost=985.73..1016.53 rows=1103 width=12) (actual time=25.328..1668.754 rows=493 loops=31)
> -> Merge Join (cost=985.73..1011.01 rows=1103 width=130) (actual time=25.321..1666.666 rows=493 loops=31)
> Merge Cond: ("outer".id_program = "inner".id_program)

The problem to address is in this subquery. That's a total of 31 x
(1668.754 - 25.328) = 50seconds (about).

Since your query is so simple, I'm guessing v_sc_user_request is a view.
Can you provide the definition?
--
Richard Huxton
Archonet Ltd

In response to

  • bad plan at 2005-03-08 10:32:03 from Gaetano Mendola

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Markus Bertheau ☭ 2005-03-08 12:20:32 pl/pgsql faster than raw SQL?
Previous Message Gaetano Mendola 2005-03-08 10:32:03 bad plan