Forum Moderators: coopster

Message Too Old, No Replies

Like performance

Speed issues when searching with like

         

justageek

9:28 pm on Mar 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



select * from db where car = 'porsche'

Will be fast if an index is used.

select * from db where car like 'pors%'

Will compare to the first example how? Will it be just as fast or slower? Thanks.

JAG

brucec

2:41 am on Mar 13, 2004 (gmt 0)

10+ Year Member



LIKE uses slightly more system resources than a plain equals, since the database has to find the stems.

whats up skip

8:11 am on Mar 15, 2004 (gmt 0)

10+ Year Member



Can you please give an example where you have successfully used the like command in a text search via php?

I have been trying to do this but with no luck.

justageek

11:37 am on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What hasn't worked for you exactly? The first example I used works fine.

JAG

jamesa

12:34 pm on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In MySQL, this:

select * from db where car like 'pors%'

shouldn't cause much of a performance hit because the way indexing is done. This would, though:

select * from db where car like '%pors%'

On the other hand I've noticed that full text indexes to be very fast, so in the latter example full text indexing might be a good option to explore.

justageek

1:35 pm on Mar 15, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've been happy with the fulltext indexes also. The problem I have is that I have about 1.5 billion pages to index and I'm trying not to go the fulltext route. I'm experimenting with some different things and was trying to figure out my best options :-)

JAG