Search Postgresql Archives

Re: Planner ignoring to use INDEX SCAN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi - been having a few problems like this myself. It's probably a
locale thing.

Here's at one of your problems:

         ->  Seq Scan on sms_new  (cost=0.00..5240444.80
rows=138939341 width=8)
               Filter: ((otid)::text !~~ 'ERROR%'::text)

I assume you have an index on sms_new?

Check the locale your database cluster has been set up with:

     SHOW lc_ctype

if it doesn't come back with "C" as your locale, then you will have to
make sure your indexes are created as follows:

CREATE INDEX IDX_sms_new
  ON YOUR_TABLE
  USING btree
  (sms_new varchar_pattern_ops);

Look at chapter 11.8 - Operator Classes for an explanation.

Unfortunately you'll need a second index if you want to use a non-
pattern matching operator, e.g. =.

If your locale is C, then I don't know what the problem is.

Hope that helps.

Will Temperley

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux