Re: [GENERAL] LIke and Indicies

2005-02-25 Thread Tom Lane
Dave Smith <[EMAIL PROTECTED]> writes: > I am using 7.4.5 and trying to use the like clause (Local C) but > postgres does not seem to want to use the index. You *sure* you're using C locale? Try "show lc_collate". If you're not, and don't want to re-initdb, you can make an index using the text_p

Re: [GENERAL] LIke and Indicies

2005-02-25 Thread Peter Eisentraut
Am Freitag, 25. Februar 2005 17:54 schrieb Dave Smith: > >From my reading of that statement it says it is going to use the index > > to match company_id=1000 and then fetch the row and compare > product_desc. Where as in the the case without the like it is using > product description in the Index C

Re: [GENERAL] LIke and Indicies

2005-02-25 Thread Thomas F . O'Connell
Looks to me like it is using an index scan in both example queries. I'm not an expert plan reader, but are you wondering why the index condition in the second query includes everything from your WHERE clause? Are you using a multi-column index that is not applicable in the first query? It's

Re: [GENERAL] LIke and Indicies

2005-02-25 Thread Dave Smith
>From my reading of that statement it says it is going to use the index to match company_id=1000 and then fetch the row and compare product_desc. Where as in the the case without the like it is using product description in the Index Condition. The speed of the queries certainly seems to bare it ou

Re: [GENERAL] LIke and Indicies

2005-02-25 Thread Peter Eisentraut
Am Freitag, 25. Februar 2005 17:31 schrieb Dave Smith: > I am using 7.4.5 and trying to use the like clause (Local C) but > postgres does not seem to want to use the index. > > explain > declare t scroll cursor for > select * from product where company_id=1000 and product_desc like 'J%' > order by

[GENERAL] LIke and Indicies

2005-02-25 Thread Dave Smith
I am using 7.4.5 and trying to use the like clause (Local C) but postgres does not seem to want to use the index. explain declare t scroll cursor for select * from product where company_id=1000 and product_desc like 'J%' order by company_id,product_desc; QUERY