Re: Query Performance Issue

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: Query Performance Issue
Дата
Msg-id 20181228153205.GM30382@telsasoft.com
обсуждение исходный текст
Ответ на Query Performance Issue  (neslişah demirci <neslisah.demirci@gmail.com>)
Ответы Re: Query Performance Issue  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-performance
On Thu, Dec 27, 2018 at 10:25:47PM +0300, neslişah demirci wrote:
> Have this explain analyze output :
> 
> *https://explain.depesz.com/s/Pra8a <https://explain.depesz.com/s/Pra8a>*

Row counts are being badly underestimated leading to nested loop joins:
|Index Scan using product_content_recommendation_main2_recommended_content_id_idx on
product_content_recommendation_main2prm (cost=0.57..2,031.03 ROWS=345 width=8) (actual time=0.098..68.314 ROWS=3,347
loops=1)
|Index Cond: (recommended_content_id = 3371132)
|Filter: (version = 1)

Apparently, recommended_content_id and version aren't independent condition,
but postgres thinks they are.

Would you send statistics about those tables ? MCVs, ndistinct, etc.
https://wiki.postgresql.org/wiki/Slow_Query_Questions#Statistics:_n_distinct.2C_MCV.2C_histogram

I think the solution is to upgrade (at least) to PG10 and CREATE STATISTICS
(dependencies).

https://www.postgresql.org/docs/10/catalog-pg-statistic-ext.html
https://www.postgresql.org/docs/10/sql-createstatistics.html
https://www.postgresql.org/docs/10/planner-stats.html#PLANNER-STATS-EXTENDED
https://www.postgresql.org/docs/10/multivariate-statistics-examples.html

Justin


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

Предыдущее
От: Alexey Bashtanov
Дата:
Сообщение: Re: Query Performance Issue
Следующее
От: David Rowley
Дата:
Сообщение: Re: Query Performance Issue