Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You cannot use an index range scan for a predicate that has a leading wildcard (i.e. <code>like '%boston%'</code>). This makes sense if you think about how an index is stored on disk-- if you don't know what the first character of the string you are searching is, you can't traverse the index to look for index entries that match that string. You may be able to do a full scan of the index where you read every leaf block and search the <code>name</code> there to see if it contains the string you want. But that requires a full scan of the index plus you then have to visit the table for every <code>ROWID</code> you get from the index in order to fetch any columns that are not part of the index that you just full-scanned. Depending on the relative size of the table and the index and how selective the predicate is, the optimizer may easily decide that it is quicker to just do a table scan if you're searching for a leading wildcard.</p> <p><a href="https://stackoverflow.com/questions/202623/does-oracle-support-full-text-search">Oracle does support full text search</a> but you have to use Oracle Text which would require that you build an Oracle Text index on the <code>name</code> column and use the <a href="http://docs.oracle.com/cd/B19306_01/text.102/b14218/cqoper.htm" rel="nofollow noreferrer">CONTAINS operator</a> to do the search rather than using a <code>LIKE</code> query. Oracle Text is very robust product so there are quite a few options to consider both in building the index, refreshing the index, and building the query depending on how sophisticated you want to get.</p> <p>Your index hint is not correctly specified. Assuming there is an index on <code>name</code>, that the name of that index is <code>name_idx</code>, and that you want to force a full scan of the index (just to reiterate, a range scan on the index is not a valid option if there is a leading wildcard), you would need something like</p> <pre><code>select /*+ index(travel_websites name_idx) */ description from travel_websites where name like '%boston%' </code></pre> <p>There is no guarantee, however, that a full index scan is going to be any more efficient than a full table scan. And it is entirely possible that the optimizer is choosing the index full scan already without the hint (you don't specify what the query plans are for the three queries).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload