Subject | RE: [firebird-support] Re: Puzzled by choice of plan |
---|---|
Author | Kevin Hamilton |
Post date | 2005-06-30T18:18:59Z |
> --- In firebird-support@yahoogroups.com, "Arno Brinkman" wrote:I'm curious, would the following have the same result as using STARTING
> > Hi,
> >
> > The problem lies in the fact that the FB1.5.x (and earlier)
> > optimizer doesn't optimize "IS NULL / STARTING WITH" operations very
> > well. First it isn't used for the JOIN order calculation and second
> > those are not combined (when possible ofcourse) with other
> > comparisons. I'm sure the FB2 optimizer does a better job here, but
> > with using the new ODS!
> >
> > Regards,
> > Arno Brinkman
> > ABVisie
>
> Set, stop thinking of STARTING WITH as similar to BETWEEN.
>
> Thanks Arno, that explains it and means that I should add "IS NULL /
> STARTING WITH" to my mental list of things to watch out for (not
> necessarily avoid) when writing queries.
WITH? Because this is how I probably would have written it:
select p.name, d.DateOfDiagnosis
from patient p
join diagnosis d on d.patientid=p.patientid where d.diagnosis
like '206%'
CONFIDENTIALITY NOTICE:
This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.