Re: Query Performance Issue

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Query Performance Issue
Дата
Msg-id CAKJS1f8933Q2z7dugFcWoWSFAF3deKLMC=98QP_SXT_qPF3J9w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Query Performance Issue  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы Re: Query Performance Issue  (Justin Pryzby <pryzby@telsasoft.com>)
Re: Query Performance Issue  (Jeff Janes <jeff.janes@gmail.com>)
Список pgsql-performance
On Sat, 29 Dec 2018 at 04:32, Justin Pryzby <pryzby@telsasoft.com> wrote:
> I think the solution is to upgrade (at least) to PG10 and CREATE STATISTICS
> (dependencies).

Unfortunately, I don't think that'll help this situation. Extended
statistics are currently only handled for base quals, not join quals.
See dependency_is_compatible_clause().

It would be interesting to see how far out the estimate is without the
version = 1 clause.  If just the recommended_content_id clause is
underestimated enough it could be enough to have the planner choose
the nested loop. Perhaps upping the stats on that column may help, but
it may only help so far as to reduce the chances of a nested loop. If
the number of distinct recommended_content_id values is higher than
the statistic targets and is skewed enough then there still may be
some magic values in there that end up causing a bad plan.

It would also be good to know what random_page_cost is set to, and
also if effective_cache_size isn't set too high.  Increasing
random_page_cost would help reduce the chances of this nested loop
plan, but it's a pretty global change and could also have a negative
effect on other queries.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: Query Performance Issue
Следующее
От: Justin Pryzby
Дата:
Сообщение: Re: Query Performance Issue