Claus,
> > I'm stuck optimizing the following query:
> > select distinct extract(year from date) as year, extract(month from
> date)
> > as month, date from week_pics order by date desc;
>
> Perhaps it would work to forget the "distinct" and instead GROUP BY
> date.
Also, do the following:
-- Make sure you have an index on week_pics.date
(Tom, did you guys ever straignten out the issue with DESC sorts on
indexes?)
-- Build the above query as a VIEW, which should improve performance
somewhat.
Technically, you could build an index on extract(month from date), I
believe, but I'm not sure how effective such an index would be in
practice.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete
informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small
businesses fax 621-2533 and non-profit organizations. San Francisco