Re: Sequencial scan instead of using index - Mailing list pgsql-performance

From Tom Lane
Subject Re: Sequencial scan instead of using index
Date
Msg-id 11754.1144795799@sss.pgh.pa.us
Whole thread Raw
In response to Re: Sequencial scan instead of using index  ("Harry Hehl" <Harry.Hehl@diskstream.com>)
List pgsql-performance
"Harry Hehl" <Harry.Hehl@diskstream.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

pgsql-performance by date:

Previous
From: "Harry Hehl"
Date:
Subject: Re: Sequencial scan instead of using index
Next
From: "Jim C. Nasby"
Date:
Subject: Re: pgmemcache