title: Sequential scan for column indexed with varchar_pattern_ops
body: <p>I have a table Users and it contains location column. I have indexed location column using varchar_pattern_ops. But when I run query planner it tells me it is doing a sequential scan. </p>
  
  <pre><code>EXPLAIN ANALAYZE
  SELECT * FROM USERS
  WHERE lower(location) like '%nepa%'
  ORDER BY location desc;
  </code></pre>
  
  <p>It gives following result:</p>
  
  <pre><code>Sort  (cost=12.41..12.42 rows=1 width=451) (actual time=0.084..0.087 rows=8 loops=1)
  Sort Key: location
  Sort Method: quicksort  Memory: 27kB
    -&gt;  Seq Scan on users  (cost=0.00..12.40 rows=1 width=451) (actual time=0.029..0.051 rows=8 loops=1)
        Filter: (lower((location)::text) ~~ '%nepa%'::text)
   Planning time: 0.211 ms
   Execution time: 0.147 ms
  </code></pre>
  
  <p>I have searched through stackoverflow. Found most answers to be like "postgres performs sequential scan in large table in case index scan will be slower". But my table is not big either.</p>
  
  <p>The index in my <code>users</code> table is:</p>
  
  <pre><code>"index_users_on_lower_location_varchar_pattern_ops" btree (lower(location::text) varchar_pattern_ops)
  </code></pre>
  
  <p>What is going on?</p>