Re: Awkward Join between generate_series and long table

Поиск
Список
Период
Сортировка
От Lincoln Swaine-Moore
Тема Re: Awkward Join between generate_series and long table
Дата
Msg-id CABcidkJw+L4CVBk2s6LhFKxJgk3DPVG06VHgWJFBVjs_wPxEVQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Awkward Join between generate_series and long table  (Philip Semanchuk <philip@americanefficient.com>)
Список pgsql-performance
> I see an estimate for 1000 rows in your EXPLAIN output too, so you're experiencing the same 
> although in your case the estimate of 1000 might be more accurate. The misestimation was causing 
> significant performance problems for me.

> My solution was to wrap generate_series() in a custom function that had a ROWS qualifier 

That's interesting! I actually wasn't familiar with the ROWs feature at all, so that is good knowledge to pocket.

In my case, I think the number of rows will vary quite a bit for different time periods/resolutions (and 1000 might not be a bad estimate for some of the workloads). I do wonder whether if the planner had a sense of how big the series result could be for longer periods/finer resolutions (which is a bit of information I could actually trivially generate outside and encode into the query explicitly if need be), it might avoid/minimize the NESTED LOOP at all costs, but I'm not sure how to communicate that information.

Anyway, thank you for sharing! Very helpful to hear what other people have dealt with in similar situations.

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

Предыдущее
От: "Abraham, Danny"
Дата:
Сообщение: RE: [EXTERNAL] Performance down with JDBC 42
Следующее
От: "James Pang (chaolpan)"
Дата:
Сообщение: simple query running long time within a long transaction.