Re: Aggregate View and Conditions taking FOREVER

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Aggregate View and Conditions taking FOREVER
Дата
Msg-id 27634.1192377528@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Aggregate View and Conditions taking FOREVER  (illusina <illusina@hotmail.com>)
Список pgsql-general
illusina <illusina@hotmail.com> writes:
> Ok..I've got a view which returns agency_id, fiscal_year, reporting_month,
> count_col0, count_col1...grouping by agency_id, fiscal_year and
> reporting_month. Now, if I just select * from myreport; it returns all the
> various counts for the various fiscal years and all that within 4 seconds,
> but if I add a conditional ie where fiscal_year = 2006 and reporting_month =
> 11, the query takes...10 minutes -- which I think is because the conditional
> cols (ie fiscal_year) is calculated via extract(year from datecol) which I
> think is causing that function to be checked on every row within the view.

Rather than guessing, how about showing EXPLAIN ANALYZE output for both
cases?

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Using C API
Следующее
От: Tom Lane
Дата:
Сообщение: Re: drop table cascade doesn't drop manual sequences