Re: Odd Choice of seq scan

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: Odd Choice of seq scan
Дата
Msg-id 20221202012124.GA14156@telsasoft.com
обсуждение исходный текст
Ответ на Odd Choice of seq scan  (Paul McGarry <paul@paulmcgarry.com>)
Ответы Re: Odd Choice of seq scan  (Ronuk Raval <ronuk.raval@gmail.com>)
Re: Odd Choice of seq scan  (Paul McGarry <paul@paulmcgarry.com>)
Список pgsql-performance
On Fri, Dec 02, 2022 at 11:52:19AM +1100, Paul McGarry wrote:
> Hi there,
> 
> I'm wondering if anyone has any insight into what might make the database
> choose a sequential scan for a query (table defs and plan below) like :

> Plan - seq scan of table:
> =====
> > explain select orders.orderid FROM orders WHERE (orders.orderid IN ('546111') OR orders.orderid IN  (select orderid
FROMorderstotrans WHERE (transid IN ('546111'))));
 

> Plan - Seq scan and filter of index:
> =====
> > explain select orders.orderid FROM orders WHERE (orders.orderid IN ('546111') OR orders.orderid IN  (select orderid
FROMorderstotrans WHERE (transid IN ('546111'))));
 

Could you show explain analyze ?

Show the size of the table and its indexes 
And GUC settings
And the "statistics" here:
https://wiki.postgresql.org/wiki/Slow_Query_Questions#Statistics:_n_distinct.2C_MCV.2C_histogram
Maybe on both a well-behaving instance and a badly-beving instance.

-- 
Justin



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

Предыдущее
От: Paul McGarry
Дата:
Сообщение: Odd Choice of seq scan
Следующее
От: Ronuk Raval
Дата:
Сообщение: Re: Odd Choice of seq scan