Subject | Re: [ib-support] Max() in view does not use index |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-05-27T09:16:15Z |
Hi Bob!
Not certain it will help, but try changing your view to
create view fiscal_saturday as
select
fiscal_week, fiscal_month, fiscal_season, fiscal_year, cal_date
from
calendar c1
where not exists (select 1 from calendar c2
where c2.cal_date > c1.cal_date
and c2.fiscal_week = c1.fiscal_week
and c2.fiscal_month = c1.fiscal_month
and c2.fiscal_year = c1.fiscal_year)
And I agree with Andrew that a composite index might be benefitial.
HTH,
Set
Not certain it will help, but try changing your view to
create view fiscal_saturday as
select
fiscal_week, fiscal_month, fiscal_season, fiscal_year, cal_date
from
calendar c1
where not exists (select 1 from calendar c2
where c2.cal_date > c1.cal_date
and c2.fiscal_week = c1.fiscal_week
and c2.fiscal_month = c1.fiscal_month
and c2.fiscal_year = c1.fiscal_year)
And I agree with Andrew that a composite index might be benefitial.
HTH,
Set