|Subject||RE: [firebird-support] Not Exists cost|
> Whether Firebird takes advantage of this factThat was my hope, but I don't think that's happening.
[mailto:firstname.lastname@example.org] On Behalf Of Tomasz Tyrakowski
Sent: Tuesday, April 03, 2012 3:31 AM
Subject: Re: [firebird-support] Not Exists cost
>> SELECT *answer to be:
>> FROM A_TABLE at
>> at.VALUE1 = 'Y' AND
>> NOT EXISTS (
>> SELECT 1
>> FROM B_TABLE bt
>> WHERE bt.VALUE2 = 'X');
> The query PLAN would tell you for certain, but I would expect the
> half of A_TABLE rows times all of B_TABLE rows.If there's an index on B_TABLE.VALUE2, it would be at most half of
A_TABLE rows times log(B_TABLE rows). Besides, your sub-query doesn't
use values from A_TABLE, so in fact it would be enough to evaluate it
once (it yields the same results for all records of A_TABLE). Whether
Firebird takes advantage of this fact or not is unfortunately beyond my
league and someone with more thorough knowledge about Firebird internals
would have to cast some light on this matter.
Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.