illusina <illusina@xxxxxxxxxxx> 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 ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/