Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: performance tuning questions: replace IN (values) by JOIN
mitt wrote:
> Jérôme Lacoste - CoffeeBreaks wrote:
>
>> select BAGS.ID as BAGS__ID, [...], >> BAG_LOG.* FROM BAGS, BAG_LOG >> WHERE (BAGS.ID = BAG_LOG.BAG_ID AND >> BAGS.ID IN (select DISTINCT(BAG_ID) FROM BAG_LOG >> WHERE DTM_TIMESTAMP >= (TO_DATE('2003-19-08 >> 00:00:00', 'yyyy-dd-mm HH24:MI:SS')) >> AND DTM_TIMESTAMP <= (TO_DATE('2003-19-08 >> 12:00:00', 'yyyy-dd-mm HH24:MI:SS')) >> ) >> ) ORDER BY BAGS.ID DESC, BAG_LOG.DTM_TIMESTAMP DESC; >> >> replace [...] by the full list of fields from the BAGS table one wants >> to retrieve. In my case all. >>
and that was obvious of course. Thanks for lightening me up.
> take additional care of having an index on bag_log.bag_id (FK);
this one was already there as BAG_ID is a foreign key.
Thanks a lot. See also my other answer to Sybrand. Received on Sat Aug 30 2003 - 13:04:36 CDT
![]() |
![]() |