Subject | question about optimizing group by |
---|---|
Author | woodsmailbox |
Post date | 2008-11-20T23:42:06Z |
Hi,
Question: does firebird optimizer knows to optimize something like:
select t.pri_key, t.other_field
from t
group by t.pri_key, t.other_field
in the sense that it should ignore t.other_field from the sorting
table?
I have seen advice to use max(t.other_field) to avoid grouping by
t.other_field.
In that case, wouldn't it help to have an aggregate function that
would just choose the first row in the group? min/max still needs an
index.
Is there any other workaround for this? Thanx!
Question: does firebird optimizer knows to optimize something like:
select t.pri_key, t.other_field
from t
group by t.pri_key, t.other_field
in the sense that it should ignore t.other_field from the sorting
table?
I have seen advice to use max(t.other_field) to avoid grouping by
t.other_field.
In that case, wouldn't it help to have an aggregate function that
would just choose the first row in the group? min/max still needs an
index.
Is there any other workaround for this? Thanx!