Re: Sequencial scan instead of using index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Harry Hehl" <Harry(dot)Hehl(at)diskstream(dot)com>
Cc: "Mark Kirkwood" <markir(at)paradise(dot)net(dot)nz>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Sequencial scan instead of using index
Date: 2006-04-11 22:49:59
Message-ID: 11754.1144795799@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Harry Hehl" <Harry(dot)Hehl(at)diskstream(dot)com> writes:
> Nested Loop IN Join (cost=21432.32..951981.42 rows=204910 width=217)
> Join Filter: ("outer".objectid = "inner".ref_oid)
> -> Append (cost=0.00..8454.10 rows=204910 width=217)
> -> Seq Scan on omfile (cost=0.00..8428.20 rows=204320
> width=217)
> -> Seq Scan on omimagefile omfile (cost=0.00..12.70 rows=270
> width=217)
> -> Seq Scan on omclipfile omfile (cost=0.00..13.20 rows=320
> width=217)
> -> Materialize (cost=21432.32..21434.32 rows=200 width=16)
> -> Unique (cost=20614.91..21430.12 rows=200 width=16)
> -> Sort (cost=20614.91..21022.52 rows=163041 width=16)
> Sort Key: ts.ref_oid
> -> Seq Scan on ts (cost=0.00..3739.41 rows=163041
> width=16)

> (11 rows)
> Time: 164.232 ms

> So how can I get index scans to work consistently with joins?

It's not the join that's the problem, it's the inheritance. I recently
improved the planner so that it can consider appended indexscans for an
inheritance tree on the inside of a join, but no pre-8.2 release can do
it.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-04-11 22:55:16 Re: pgmemcache
Previous Message markir 2006-04-11 22:20:55 Re: Sequencial scan instead of using index