Optimize join selectivity estimation by not reading MCV stats for unique join attributes

Поиск
Список
Период
Сортировка
От David Geier
Тема Optimize join selectivity estimation by not reading MCV stats for unique join attributes
Дата
Msg-id b9846ca0-5f1c-9b26-5881-aad3f42b07f0@gmail.com
обсуждение исходный текст
Ответы Re: Optimize join selectivity estimation by not reading MCV stats for unique join attributes  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi hackers,

eqjoinsel() can be optimized by not reading MCV stats if at least one of 
the two join attributes is unique. As primary keys are implicitly unique 
this situation can occur frequently. For unique columns no MCV stats are 
stored and eqjoinsel_inner() and eqjoinsel_semi(), called from 
eqjoinsel(), only consider MCV stats in the join selectivity computation 
if they're present on both columns. Attached is a small patch that 
implements the skipping.

With this change we saw some queries improve planning time by more than 
2x, especially with larger values for default_statistics_target. That's 
because get_attstatsslot() deconstructs the array holding the MCV. The 
size of that array depends on default_statistics_target.

Thanks for your consideration!

--
David Geier
(ServiceNow)

Вложения

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

Предыдущее
От: Pavel Borisov
Дата:
Сообщение: Re: Lockless queue of waiters in LWLock
Следующее
От: Maxim Orlov
Дата:
Сообщение: Re: Add LSN along with offset to error messages reported for WAL file read/write/validate header failures