Subject | Re: [firebird-support] Re: performance of subselect with group by |
---|---|
Author | Björn Reimer |
Post date | 2014-12-18T18:45:32Z |
Hello,
thanks Set, makes my test unnecessary!
But I'm thinking a little bit about my original problem.
Would it make sense to add a tracker entry for optimization of
subselects without reference to outer query?
I think that they should get evaluated and transformed to something
like a "or" connected list of simple compares.
So
delete from test where Id in (
select min(t.Id) FROM test t
group by t.reference, t.key
having count(*) > 1
)
could be transformed by the engine to
delete from test where Id = 5 or Id = 6 or Id = 89
in case of
select min(t.Id) FROM test t
group by t.reference, t.key
having count(*) > 1
would return 5,6,89
I've found several similar questions in my mail archive so I think
I'm not the only one with such a problem.
A common use case would be to remove duplicate entries for
example to create a unique index.
Any comments?
--
Björn Reimer - RRZE
thanks Set, makes my test unnecessary!
But I'm thinking a little bit about my original problem.
Would it make sense to add a tracker entry for optimization of
subselects without reference to outer query?
I think that they should get evaluated and transformed to something
like a "or" connected list of simple compares.
So
delete from test where Id in (
select min(t.Id) FROM test t
group by t.reference, t.key
having count(*) > 1
)
could be transformed by the engine to
delete from test where Id = 5 or Id = 6 or Id = 89
in case of
select min(t.Id) FROM test t
group by t.reference, t.key
having count(*) > 1
would return 5,6,89
I've found several similar questions in my mail archive so I think
I'm not the only one with such a problem.
A common use case would be to remove duplicate entries for
example to create a unique index.
Any comments?
--
Björn Reimer - RRZE