Subject | Re: Odp: [firebird-support] Indexes on subquery |
---|---|
Author | Umberto Masotti |
Post date | 2013-11-30T17:44:22Z |
Hi Ann,
it's allways a pleasure reading from you: there's anyway something to learn!
Ann Harrison <aharrison@...> ha scritto:
statement relative to the context of the thread, where
SUBQUERYTABLE.ID2 is a PK, so there are no chance to have more than
one (and only one) distinct value for each ID2.
I should have mentioned it for clarity; a PRIMARY KEY or an UNIQUE
index on ID2 give the same result.
Sorry for my insufficient comment.
Have nice day.
MM
it's allways a pleasure reading from you: there's anyway something to learn!
Ann Harrison <aharrison@...> ha scritto:
>> On Nov 29, 2013, at 12:10 PM, Umberto Masotti <masotti@...> wrote:You are right, because I forgot to report clearly the limit of my
>>
>>> select id from TEST T where exists(select * from subquerytable sq
>>> where sq.id2 = t.id2)
>>
>> That query seems logically equivalent to
>>
>> SELECT id FROM TEST T JOIN SUBQUERYTABLE SQ ON (T.id2=SQ.id2)
>
> The two queries are the same if there is at most one SQ.id2 for eacht T.id2.
statement relative to the context of the thread, where
SUBQUERYTABLE.ID2 is a PK, so there are no chance to have more than
one (and only one) distinct value for each ID2.
I should have mentioned it for clarity; a PRIMARY KEY or an UNIQUE
index on ID2 give the same result.
Sorry for my insufficient comment.
Have nice day.
MM