Re: LIKE not using indexes (due to locale issue?)

From: Klint Gore <kgore4(at)une(dot)edu(dot)au>
To: Ow Mun Heng <Ow(dot)Mun(dot)Heng(at)wdc(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: LIKE not using indexes (due to locale issue?)
Date: 2008-06-25 08:22:24
Message-ID: 48620040.4020209@une.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ow Mun Heng wrote:
> Could it be that it's not able to determine the B2.%.SX in there?
>
> explain select count(*) from d_trr_iw where ast_revision like 'B2.P.SX'
>
> even this will result in a seq_scan.
>
How many values have you got that start with 'B2.'? If it's more than
about 5% then it's probably quicker to sequential scan anyway.

Since the equals query says there's one row with a P in the middle, what
does this say?

explain select count(*) from d_trr_iw where ast_revision like 'B2.P%.SX'

or pick a value that you know can't exist e.g. if ast_revision can never start with WW then

explain select count(*) from d_trr_iw where ast_revision like 'WW.%.SX'

klint.

--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350

Ph: 02 6773 3789
Fax: 02 6773 3266
EMail: kgore4(at)une(dot)edu(dot)au

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tomasz Ostrowski 2008-06-25 08:24:18 Re: Probably been asked a hundred times before.
Previous Message Sam Mason 2008-06-25 08:14:51 Re: pg_dump estimation