Subject Re: Stored procedure performance
Author Adam
> select entity_id, entity_name, entity_datein, link_id, link_link
> from entities
> inner join links on (entities.entity_id =
links.link_fk_entity_id)
> where
> (entities.entity_id = :entity_id_in)
> and
> (links.link_id not in (
> select l_v_fk_link_id from links_visited where
> l_v_fk_link_visits_id = :link_v_id_in
> )
> )
> rows :rows_qty


Your problem is the 'not in' clause. Check the release notes, not in
is unable to use an index because of the possibility of nulls giving
you the wrong answer. Rewrite it as a 'not exists' and it will be fine.

Adam