From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Allen Landsidel <alandsidel(at)gmail(dot)com> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Strange (?) Index behavior? |
Date: | 2004-11-05 19:57:40 |
Message-ID: | 10898.1099684660@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Allen Landsidel <alandsidel(at)gmail(dot)com> writes:
> With that many rows, and a normal index on the field, postgres figures
> the best option for say "I%" is not an index scan, but a sequential
> scan on the table, with a filter -- quite obviously this is slow as
> heck, and yes, I've run analyze several times and in fact have the
> vacuum analyze automated.
> With the partial index the index scan is used and the cost drops from
> 0..2million to 0..9000 -- a vast improvement.
Hmm. This suggests to me that you're using a non-C locale and so a
plain index *can't* be used for a LIKE query. Can you force it to use
an indexscan by setting enable_seqscan = false? If not then you've got
a locale problem. As someone else pointed out, this can be worked
around by creating an index with the right operator class.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-11-05 20:32:28 | Re: What is the difference between these? |
Previous Message | Matthew T. O'Connor | 2004-11-05 19:44:17 | Re: What is the difference between these? |