Re: [GENERAL] Yet Another (Simple) Case of Index not used

From: "Denis (at) Next2Me" <denis(at)next2me(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com>, "Denis (at) Next2Me" <denis(at)next2me(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [GENERAL] Yet Another (Simple) Case of Index not used
Date: 2003-04-09 05:54:46
Message-ID: EKEBJNAJDPKJBDFGJNIJGEOADBAA.denis@next2me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-performance pgsql-sql

Stephan, Martijn,
good call, that was it: the C locale.

I had used all the default settings when installing/creating the database,
and apparently it used my default locale (en_US).
I recreated (initdb) the database with --no-locale, and recreated the database,
and sure enough, the query:
select count(*) from table where table.column like 'fol%'
was a zillion (well almost) time faster than it used to be,
and on pair with mysql's performance.
And as expected, the EXPLAIN on that query does show indeed
the use of the index I had created on the table.

Sweet, I can now nuke mysql out of my system.

Folks, thank you all for the help and other suggestions.

Denis Amselem
Next2Me Inc.

Stephan said:
> If it doesn't use the index (ie, it's still using a sequential scan)
> after the enable_seqscan=off it's likely that you didn't initdb in "C"
> locale in which case like won't use indexes currently (you can see the
> archives for long description, but the short one is that some of the
> locale rules can cause problems with using the index).

Martijn said:

> Ah, but that may be caused by something else altogether. LIKE is only
> indexable in the C locale so if you have en_US as your locale, your LIKE
> won't be indexable. See the discussion threads on this mailing list in the past.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Riza Fahmi 2003-04-09 06:07:26 altering table
Previous Message Tom Lane 2003-04-09 04:51:57 Re: Question on initdb and subsequent start

Browse pgsql-performance by date

  From Date Subject
Next Message Shridhar Daithankar 2003-04-09 15:42:56 [OT][Announce] Availability of OAS Server pakcages
Previous Message Matthew Nuzum 2003-04-09 03:38:44 choosing the right platform

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2003-04-09 07:17:59 question about visibilty while updating multiple rows .
Previous Message Rudi Starcevic 2003-04-09 04:59:34 Re: CASE