Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Full table scan even though indexes are defined

jaijeevaFeb 13 2016 — edited Feb 15 2016

Hi,

  I am having a table(lf_hotel_temp) which contains 3 lakh records. While running explain plan for below query its not using indexes. And it seems, its doing full table scan.Actually i have created primary key (hotel_code,service_id) in lf_hotel_temp  and also created non unique index on hotel_code column in rest of all tables. pls help me to  avoid full table scan in below query.

SELECT a.hotel_code

  FROM lf_hotel_temp a

WHERE a.service_id = : p_service_id

       AND (NOT EXISTS (SELECT *

          FROM lf_ts_roomtype_properties b

         WHERE a.hotel_code = b.hotel_code)

        or NOT EXISTS (SELECT *

          FROM lf_gta_roomtype_properties b

         WHERE a.hotel_code = b.hotel_code) 

       or  NOT EXISTS (SELECT *

          FROM lf_hb_roomtype_properties b

         WHERE a.hotel_code = b.hotel_code))

                                                                                                                                                       cost    cardinality bytes

SELECT STATEMENT, GOAL = ALL_ROWS13512613113517
FILTER
  TABLE ACCESS FULLLF_HOTEL_TEMP13588433795897
  INDEX RANGE SCANLF_TS_ROOMTYPE_PROP_IDX117
  INDEX RANGE SCANLF_GTA_ROOMTYPE_PROP_IDX119
  INDEX RANGE SCANLF_HB_ROOMTYPE_PROP_IDX3214

Regards,

Jai

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2016
Added on Feb 13 2016
34 comments
79,646 views