Re: Dealing with complex queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Francisco J Reyes <fran(at)natserv(dot)net>
Cc: Francisco Reyes <lists(at)natserv(dot)com>, pgsql General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Dealing with complex queries
Date: 2003-02-07 02:58:09
Message-ID: 23267.1044586689@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Francisco J Reyes <fran(at)natserv(dot)net> writes:
> -> Nested Loop (cost=0.00..21773591.67 rows=456 width=51) (actual time=463.34..737215.23 rows=1591 loops=1)
> Join Filter: ("outer".ppl_key = "inner".ppl_key)
> -> Index Scan using people_pplkey on people pe (cost=0.00..2991.02 rows=2234 width=8) (actual time=0.19..397.73 rows=1591 loops=1)
> Filter: (("type" = 'j'::bpchar) AND (jt_id = 0))
> -> Seq Scan on pplkeys ppl (cost=0.00..8929.70 rows=65324 width=43) (actual time=0.06..421.59 rows=6770 loops=1591)
> Filter: ("type" = 'j'::bpchar)

Seems the main problem is this innermost join --- it's using the
stupidest possible form of join. At the very least you'd like it
to use an index on pplkeys. Are people.ppl_key and pplkeys.ppl_key
the same datatype? Does the latter have an index?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-02-07 03:00:50 Re: AllocSetAlloc() error message
Previous Message Tom Lane 2003-02-07 02:50:24 Re: Problem with files size in /var/lib/postgres/data/global on Debian Woody