Subject | Re: [firebird-support] Query optimizer question related to the IN clause |
---|---|
Author | Ann W. Harrison |
Post date | 2006-12-08T16:20:48Z |
ckarasinir wrote:
performance
select distinct l.location_id
from location l
join finding f on f.location.id = l.location_id
join survey_finding s on s.finding_id = f.finding_id
where s.survey_id = '536313bd-427e-42db-964e-7a8c9092c455'
Regards,
Ann
>If it were possible to generate this instead, you'd get a better
> I am using a tool that maps relational structures to programmatic
> entities and it generates the SQL automatically.
> When loading a hierarchy of objects it uses the IN clause extensively
> in the following way (the query is simplified)
>
> SELECT LOCATION.LOCATION_ID
> FROM LOCATION
> WHERE LOCATION.LOCATION_ID
> IN (SELECT FINDING.LOCATION_ID
> FROM FINDING INNER JOIN SURVEY_FINDING ON FINDING.FINDING_ID=
> SURVEY_FINDING.FINDING_ID
> WHERE SURVEY_FINDING.SURVEY_ID =
> '536313bd-427e-42db-964e-7a8c9092c455')
performance
select distinct l.location_id
from location l
join finding f on f.location.id = l.location_id
join survey_finding s on s.finding_id = f.finding_id
where s.survey_id = '536313bd-427e-42db-964e-7a8c9092c455'
Regards,
Ann