Seq Scan vs Index on Identical Tables in Two Different Databases

Поиск
Список
Период
Сортировка
От Ellen Rothman
Тема Seq Scan vs Index on Identical Tables in Two Different Databases
Дата
Msg-id d2c495ac125a4e94acd463a6981136f2@BLUPR08MB166.namprd08.prod.outlook.com
обсуждение исходный текст
Ответы Re: Seq Scan vs Index on Identical Tables in Two Different Databases  (bricklen <bricklen@gmail.com>)
Re: Seq Scan vs Index on Identical Tables in Two Different Databases  (David Johnston <polobo@yahoo.com>)
Re: Seq Scan vs Index on Identical Tables in Two Different Databases  (David Kerr <dmk@mr-paradox.net>)
Список pgsql-performance

I have the same table definition in two different databases on the same computer. When I explain a simple query in both of them, one database uses a sequence scan and the other uses an index scan.  If I try to run the Seq Scan version without the where clause restricting the value of uniqueid, it uses all of the memory on my computer and never completes.

 

How can I get the Seq Scan version to use an index scan?

 

Explain results – good version:

"GroupAggregate  (cost=0.00..173.78 rows=1 width=15)"

"  ->  Index Scan using pubcoop_ext_idx1 on pubcoop_ext  (cost=0.00..173.77 rows=1 width=15)"

"        Index Cond: (uniqueid < '000000009'::bpchar)"

 

Explain results – problem version:

"HashAggregate  (cost=13540397.84..13540398.51 rows=67 width=18)"

"  ->  Seq Scan on pubcoop_ext  (cost=0.00..13360259.50 rows=36027667 width=18)"

"        Filter: (uniqueid < '000000009'::bpchar)"

 

 

Thanks,

Ellen

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

Предыдущее
От: Xenofon Papadopoulos
Дата:
Сообщение: Re: Distributed transactions and asynchronous commit
Следующее
От: bricklen
Дата:
Сообщение: Re: Seq Scan vs Index on Identical Tables in Two Different Databases