Re: [EXPLAIN] Nested loops

From: Reg Me Please <regmeplease(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: "Victor Nawothnig" <victor(dot)nawothnig(at)gmail(dot)com>
Subject: Re: [EXPLAIN] Nested loops
Date: 2009-01-09 18:49:58
Message-ID: 200901091949.58978.regmeplease@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here it comes:

Aggregate (cost=227.59..227.61 rows=1 width=8)
-> Nested Loop (cost=0.00..227.34 rows=49 width=8)
-> Seq Scan on T2 (cost=0.00..1.07 rows=6 width=4)
Filter: (fld1 = 'VEND'::text)
-> Index Scan using i_T1_partial on T1 (cost=0.00..37.61 rows=8
width=8)
Index Cond: ((T1.prod_id = 42) AND (T1.fk1 = T2.fk1))

On Friday 09 January 2009 19:22:28 Victor Nawothnig wrote:
> Could you provide the output of EXPLAIN ANALYZE with your query?
>
> On Fri, Jan 9, 2009 at 7:06 PM, Reg Me Please <regmeplease(at)gmail(dot)com> wrote:
> > Hi.
> >
> > For an INNER JOINed query, EXPLAIN says that a "nested loop" is
> > responsible for the big part of the time needed to run.
> >
> > The 2 tables JOINed are:
> >
> > T1: multi-million rows
> > T2: few dozens rows
> >
> > The join is though a single column in both sides and it's NOT a PK in
> > either table. But I have indexes in both T1 and T2 for that column.
> >
> > I've read in the "Explaining EXPLAIN" by Rober Treat
> > (at
> > http://wiki.postgresql.org/wiki/Image:OSCON2005-ExplainingExplain.sxi)
> > that this nested loop can be slow because of lacking of indexes.
> >
> > Is there any hint to try to speed that query up?
> >
> > As of now, only a REINDEX can help thanks to caching, I presume.
> > But the EXPLAIN still says there's a slow nested loop.
> >
> > --
> > Fahrbahn ist ein graues Band
> > weisse Streifen, grüner Rand
> >
> > --
> > Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-general

--
--
Fahrbahn ist ein graues Band
weisse Streifen, grüner Rand

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Pundt 2009-01-09 19:00:36 Re: [EXPLAIN] Nested loops
Previous Message Tom Lane 2009-01-09 18:22:43 Re: Improving compressibility of WAL files