Subject | Re: group by or distinct |
---|---|
Author | kaczy27 |
Post date | 2004-09-02T09:19:30Z |
--- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@m...>
wrote:
I am not asking what is the point in grouping all fields, there is a
point, I can later left join the subset with varying grouping
function (yes, I know I can do that via CASE, but at the query
execution time, I do not know what kind of grouping operation will
be perforemed, yet I need to know the set of those possible
operation) still it is not important.
I only want to know which one is faster.
exists (select 1 .....) is seemingly faster than search id ... where,
(questione here as well, what is faster exists (select 1 ...) or
select FIRST id from table1 where ....) ??
and those two queries (group by and distinct) do (imnsho, but I
might be wrong) the exact same thing, my initial feeling is that
distinct will perform faster, I wanted it to be confirmed by someone
who knows/tested it.
wrote:
> > > > hello,aggregating
> > > >
> > > > what is faster in such case:
> > > >
> > > > select
> > > > field1, field2, field3
> > > > from
> > > > table1
> > > > group by
> > > > field1, field2, field3;
> > > >
> > > > or
> > > >
> > > > select distinct
> > > > field1, field2, field3
> > > > from
> > > > table1;
> > > >
> > > > CUIN Kaczy
> > >
> > > different results for each - which one do you want?
> > different?? what do I miss? what is the difference?
> >
> > > Alan
> > CUIN Kaczy
>
> There's no point in grouping by a set of fields unless you are
> an additional field.distinct results perhaps?
> select
> field1, field2, field3, sum(field4)
> from
> table1
> group by
> field1, field2, field3;
>
> what do you want the goup by to return in terms of actual grouping?
I am not asking what is the point in grouping all fields, there is a
point, I can later left join the subset with varying grouping
function (yes, I know I can do that via CASE, but at the query
execution time, I do not know what kind of grouping operation will
be perforemed, yet I need to know the set of those possible
operation) still it is not important.
I only want to know which one is faster.
exists (select 1 .....) is seemingly faster than search id ... where,
(questione here as well, what is faster exists (select 1 ...) or
select FIRST id from table1 where ....) ??
and those two queries (group by and distinct) do (imnsho, but I
might be wrong) the exact same thing, my initial feeling is that
distinct will perform faster, I wanted it to be confirmed by someone
who knows/tested it.
> AlanCUIN Kaczy