| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | gregory <gperuch(at)citer(dot)fr> |
| Cc: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: BUG #1325: like error |
| Date: | 2004-11-18 14:18:44 |
| Message-ID: | 20041118061342.D72782@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Thu, 18 Nov 2004, PostgreSQL Bugs List wrote:
> select * from tbinvoicerows
> where invoicecd = 'FLOCAA00000025'
>
> result in 0 seconde with 2 records NO BUG
>
> select * from tbinvoicerows
> where invoicecd like '%FLOCAA00000025%'
>
> result in 40 secondes with 2 records NO BUG
>
> select * from tbinvoicerows
> where invoicecd like 'FLOCAA00000025%'
>
> result in 40 secondes with 2 records BUG
> Bug : the result is good but I expect a result faster as the first select
> (like in mssql 7)
To add to the reply already given...
If you're running in "C" locale, the last should be able to use a normal
index on invoicecd. However, since that didn't appear to happen, either
it's estimating a large number of rows which is unlikely or you are in
some other locale.
For other locales, you may want a pattern_ops index, which would be
something like:
create index foo on tbinvoicerows(invoicecd varchar_pattern_ops).
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Cao Duy | 2004-11-18 14:47:16 | column doesnt exist? |
| Previous Message | Richard Huxton | 2004-11-18 11:56:50 | Re: BUG #1325: like error |