Performance issue post upgrade on Version 13 - Incorrect Estimation Cost choosing Hash Aggregate-Nested Left Loop Join

Поиск
Список
Период
Сортировка
От Prajna Shetty
Тема Performance issue post upgrade on Version 13 - Incorrect Estimation Cost choosing Hash Aggregate-Nested Left Loop Join
Дата
Msg-id MAZPR01MB546945FEA4E21EE7C8E532FB92169@MAZPR01MB5469.INDPRD01.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответы Re: Performance issue post upgrade on Version 13 - Incorrect Estimation Cost choosing Hash Aggregate-Nested Left Loop Join  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs

Hello Team,

 

There is change in query plan in 12.4 version and Version 13 resulting in performance slowness post upgrade.

 

  • In 12.4 version, Sort Operation Group Aggregate is selected which results to Merge Join. Query takes ~5 seconds.
  • In 13.5 version, optimizer wrongly estimates and due to new Disk Based Hash Aggregate feature, it prefers Hash Aggregate instead of Sort Operation which finally blocks merge-join and chooses Nested Loop Left Join. Query takes ~5 minutes.

 

When we increase work_mem to 23 MB, Disk Usage gets cleared from Query Plan but still Optimizer estimates Hash Aggregate-Nested Loop Left Join (compared to Sort-Merge Join) causing slowness. Query takes ~22 seconds.

 

Version 13 query plan has lower estimated cost than that of 12.4 which implies 13.5 planner thought it found a better plan, but it is running slower.

 

12.4 Version:

"Merge Right Join  (cost=202198.78..295729.10 rows=1 width=8) (actual time=1399.727..5224.574 rows=296 loops=1)"

 

13.5 version:-

"Nested Loop Left Join  (cost=196360.90..287890.45 rows=1 width=8) (actual time=3209.577..371300.693 rows=296 loops=1)"

 

 

 

Thanks & Regards,

 

Prajna Shetty
Technical Specialist,

Data Platform Support & Delivery




http://www.mindtree.com/email/disclaimer.html
Вложения

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

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: BUG #17443: Select command does not use brin index when enable_seqscan = on
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17444: ERROR: found xmin 215633 from before relfrozenxid 1280585