Re: [PERFORM] LIKE search and performance

2007-05-24 Thread PFC
PG could scan the index looking for matches first and only load the actual rows if it found a match, but that could only be a possible win if there were very few matches, because the difference in cost between a full index scan and a sequential scan would need to be greater than the cost of rand

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread Craig James
Alvaro Herrera wrote: >> Just out of curiosity: Does Postgress store a duplicate of the data in the index, even for long strings? I thought indexes only had to store the string up to the point where there was no ambiguity, for example, if I have "missing", "mississippi" and "misty", the index

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread mark
On Thu, May 24, 2007 at 02:02:40PM -0700, Mark Lewis wrote: > PG could scan the index looking for matches first and only load the > actual rows if it found a match, but that could only be a possible win > if there were very few matches, because the difference in cost between a > full index scan and

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread Alvaro Herrera
Craig James wrote: > Mark Lewis wrote: > > >PG could scan the index looking for matches first and only load the > >actual rows if it found a match, but that could only be a possible win > >if there were very few matches, because the difference in cost between a > >full index scan and a sequential

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread Craig James
Mark Lewis wrote: PG could scan the index looking for matches first and only load the actual rows if it found a match, but that could only be a possible win if there were very few matches, because the difference in cost between a full index scan and a sequential scan would need to be greater tha

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread Mark Lewis
On Thu, 2007-05-24 at 21:54 +0100, James Mansion wrote: > > If Sybase is still like SQL Server (or the other way around), it *may* > > end up scanning the index *IFF* the index is a clustered index. If it's > > a normal index, it will do a sequential scan on the table. > > > > > Are you sure its

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread James Mansion
If Sybase is still like SQL Server (or the other way around), it *may* end up scanning the index *IFF* the index is a clustered index. If it's a normal index, it will do a sequential scan on the table. Are you sure its not covered? Have to check at work - but I'm off next week so it'll hav

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread Magnus Hagander
James Mansion wrote: > Alexander Staubo wrote: >> On 5/23/07, Andy <[EMAIL PROTECTED]> wrote: >>> An example would be: >>> SELECT * FROM table >>> WHERE name like '%john%' or street like >>> '%srt%' >>> >>> Anyway, the query planner always does seq scan on the whole tab

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread James Mansion
Alexander Staubo wrote: On 5/23/07, Andy <[EMAIL PROTECTED]> wrote: An example would be: SELECT * FROM table WHERE name like '%john%' or street like '%srt%' Anyway, the query planner always does seq scan on the whole table and that takes some time. How can this

Re: [PERFORM] LIKE search and performance

2007-05-24 Thread Andy
Thank you all for the answers. I will try your suggestions and see what that brings in terms of performance. Andy. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Rigmor Ukuhe > Sent: Wednesday, May 23, 2007 6:52 PM > Cc: pgsql-performance@po