From: Richard Huxton <dev@archonet.com>
To: Gaetano Mendola <mendola@bigfoot.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: bad plan
Date: Tue, 08 Mar 2005 11:39:58 +0000
Message-ID: <422D8F0E.8000906@archonet.com> (raw)
In-Reply-To: <422D7F23.7000109@bigfoot.com>
References: <422D7F23.7000109@bigfoot.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: dev@archonet.com, mendola@bigfoot.com
Subject: Re: bad plan
In-Reply-To: <422D8F0E.8000906@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox