[thelist] constructing a good search string/query

Pete Freitag pf at cfdev.com
Mon May 2 16:23:21 CDT 2005


Dan McCullough wrote:

>Guess what?  Its SLOWWWWWWWWWWWWWWWWWWWW!
>select * from search_string where lower(searchstring) like '%"+searchTerm+"%'
>  
>
Some other things you might try to speed it up even more...

- If your DB supports it create a full text index on your table
- Don't use select *, select only the column names you need. With the * 
the DB also has to look up what columns are in the table, and often 
times you don't need all columns returned.
- Index other columns that are searched


______________________________________
Pete Freitag
work: http://www.cfdev.com/
blog: http://www.petefreitag.com/
shop: http://www.dealazon.com/

Author of the CFMX Developers Cookbook
http://www.petefreitag.com/bookshelf/






More information about the thelist mailing list