Re: Planner ignoring to use INDEX SCAN

From: Will <willtemperley(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Planner ignoring to use INDEX SCAN
Date: 2007-12-17 16:03:29
Message-ID: 3e08969c-5646-416f-98b8-0b43375e6b97@e25g2000prg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lew 2007-12-17 16:11:09 Re: top posting
Previous Message SHARMILA JOTHIRAJAH 2007-12-17 14:15:16 slony error --need help