pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Petr Praus <petr@praus.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: Increasing work_mem and shared_buffers on Postgres 9.2 significantly slows down queries
Date: Fri, 9 Nov 2012 18:53:45 +0100
Message-ID: <20121109175345.GA16999@awork2.anarazel.de> (raw)
In-Reply-To: <CACezXZ_w7HbqSxZ=5SJH=kxb4nBDNbpDejttSaU6EC1AeO4PYg@mail.gmail.com>
References: <CACezXZ_w7HbqSxZ=5SJH=kxb4nBDNbpDejttSaU6EC1AeO4PYg@mail.gmail.com>

On 2012-10-30 14:08:56 -0500, Petr Praus wrote:
>     select count(*) from contest c
>     left outer join contestparticipant cp on c.id=cp.contestId
>     left outer join teammember tm on tm.contestparticipantid=cp.id
>     left outer join staffmember sm on cp.id=sm.contestparticipantid
>     left outer join person p on p.id=cp.personid
>     left outer join personinfo pi on pi.id=cp.personinfoid
>     where pi.lastname like '%b%' or pi.firstname like '%a%';

Btw, not really related to the question, but the way you use left joins
here doesn't really make sense and does lead to inferior plans.
As you restrict on 'pi', the rightmost table in a chain of left joins,
there is no point in all those left joins. I would guess the overall
plan is better if use straight joins.

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services




view thread (27+ messages)

Message-ID: <20121109175345.GA16999@awork2.anarazel.de>
Permalink:  ../20121109175345.GA16999@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20121109175345.GA16999@awork2.anarazel.de

 · 

reply

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: andres@2ndquadrant.com, petr@praus.net
  Subject: Re: Increasing work_mem and shared_buffers on Postgres 9.2 significantly slows down queries
  In-Reply-To: <20121109175345.GA16999@awork2.anarazel.de>

* 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