Re: Can I force a query plan to materialise part?

From: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>
To: Toby Corkindale <toby(dot)corkindale(at)strategicdata(dot)com(dot)au>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Can I force a query plan to materialise part?
Date: 2012-10-02 03:02:50
Message-ID: CAM6mieKhRdqYBbBWtsPyEpoyB3WT+uurw-Q9v1xXSEmuwKpUVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On 2 October 2012 12:33, Toby Corkindale
<toby(dot)corkindale(at)strategicdata(dot)com(dot)au> wrote:
> I have a query that joins two views, and takes 28 seconds to run.
> However if I create temporary tables that contain the contents of each view,
> and then join them, the total time is 1.3 seconds.

try "offset 0" (or you can tweak statistics collector to get better estimates):
select ... from (select * from view offset 0) as v ....

http://blog.endpoint.com/2009/04/offset-0-ftw.html

--
Ondrej Ivanic
(ondrej(dot)ivanic(at)gmail(dot)com)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Toby Corkindale 2012-10-02 03:22:57 Re: Can I force a query plan to materialise part?
Previous Message David Johnston 2012-10-02 02:44:29 Re: Can I force a query plan to materialise part?