Re: Slow query with join

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Marc Watson <mark(dot)watson(at)jurisconcept(dot)ca>
Subject: Re: Slow query with join
Date: 2015-03-16 21:06:36
Message-ID: 8884.1426539996@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> writes:
> On 16.3.2015 19:50, Marc Watson wrote:
>> I hope someone can help me with a problem I'm having when joining a
>> view with a table. The view is somewhat involved, but I can provide the
>> details if necessary

> First, get rid of the ORDER BY clauses in the subselects - it's
> completely pointless, and might prevent proper optimization (e.g.
> replacing the IN() with optimized joins.

I'm suspicious that the cause may be an ORDER BY in the view. It's
hard to tell when we've not seen the view definition, but I see that both
plans we've been shown are going to produce output sorted by actor.id.
Maybe that's happenstance, or maybe not.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2015-03-16 21:30:45 How does one make the following psql statement sql-injection resilient?
Previous Message Tomas Vondra 2015-03-16 20:50:34 Re: Slow query with join