Index Usage using IN

Поиск
Список
Период
Сортировка
От Ralph Mason
Тема Index Usage using IN
Дата
Msg-id 43E1164B.7020104@telogis.com
обсуждение исходный текст
Ответы Re: Index Usage using IN  ("Jeffrey W. Baker" <jwbaker@acm.org>)
Re: Index Usage using IN  (Bruno Wolff III <bruno@wolff.to>)
Re: Index Usage using IN  (Hari Warrier <hbhaskaran@gmail.com>)
Список pgsql-performance
Hi,

I have 2 tables both have an index on ID (both ID columns are an oid).

I want to find only only rows in one and not the other.

Select ID from TableA where ID not IN ( Select ID from Table B)

This always generates sequential scans.

Table A has about 250,000 rows.   Table B has about 250,000 Rows.

We should get a Scan on Table B and a Index Lookup on Table A.

Is there any way to force this?  enable_seqscan off doesn't help at all.

The Plan is

Seq Scan on tablea(cost=100000000.00..23883423070450.96 rows=119414 width=4)
  Filter: (NOT (subplan))"
  SubPlan    ->
     Seq Scan on tableb (cost=100000000.00..100004611.17 rows=242617
width=4)


Thanks
Ralph




В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Planner reluctant to start from subquery
Следующее
От: "Jeffrey W. Baker"
Дата:
Сообщение: Re: Index Usage using IN