<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Search with LIKE --> very very slow"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "Search with LIKE --> very very slow"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Search with LIKE --&amp;gt; very very slow</title>
				<description><![CDATA[ Hello,
I have imported the geonames data in a <b>oracle database</b>. That is working fine so far.

But now my problem is when I search certain entries with my select statement. 

To get all rows of (in this example: London) my select statement looks like this:

select * from TABLE1 where NAME LIKE '% London' OR NAME LIKE 'London %' OR NAME LIKE '% London %' OR NAME = 'London'

I created an index for the name column:
create index my_name_idx on TABLE1(NAME);

But the problem is, that the index is not used when I search with Like

Therefore when I start a select statement like this one here, it took very long until I get my result.

Are there any possibilities to make my search a bit faster. Maybe are there other indexes which can be used with like.

Thanks for the help.

Regards]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1692.page#6968</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1692.page#6968</link>
				<pubDate><![CDATA[Wed, 13 Jan 2010 11:27:44]]> GMT</pubDate>
				<author><![CDATA[ oracle_user]]></author>
			</item>
			<item>
				<title>Re:Search with LIKE --&amp;gt; very very slow</title>
				<description><![CDATA[ You should look at Full-text search indexes. I have no idea if oracle offer such a thing - but would be very surprised if they dont. 


If not look at something like sphinxsearch.com - works great with geonames data. Shouldnt be too difficult to hook up to a oracal database, either using odbc, 
http://sphinxsearch.com/docs/current.html#conf-odbc-dsn
or xmlpipe

]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1692.page#6969</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1692.page#6969</link>
				<pubDate><![CDATA[Wed, 13 Jan 2010 13:31:24]]> GMT</pubDate>
				<author><![CDATA[ barryhunter]]></author>
			</item>
			<item>
				<title>Re:Search with LIKE --&amp;gt; very very slow</title>
				<description><![CDATA[  select * from TABLE1 where NAME LIKE '% London' OR NAME LIKE 'London %' OR NAME LIKE '% London %' OR NAME = 'London' 

Hi,

That's a killing query when you have a lot of rows!  When you use the % sign in front of the search keyword. It scans the whole table (without index) to get the match. Can be anything from 1 to 9 and from a to z.

Can get faster with more (hardware)resources.

So re-define your query and get try it without the % before the keyword. Must be faster. 

Thanks,
Ron Sahertian]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1692.page#6970</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1692.page#6970</link>
				<pubDate><![CDATA[Wed, 13 Jan 2010 13:35:03]]> GMT</pubDate>
				<author><![CDATA[ sahertian]]></author>
			</item>
			<item>
				<title>Re:Search with LIKE --&amp;gt; very very slow</title>
				<description><![CDATA[ Hi,
thanks for the answers.

I solved it. The solution is called Oracle Text Index.

Instead of using like you have to work with contains then. With this the sql is much faster.

Regards]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/1692.page#6971</guid>
				<link>http://forum.geonames.org/gforum/posts/list/1692.page#6971</link>
				<pubDate><![CDATA[Wed, 13 Jan 2010 17:16:38]]> GMT</pubDate>
				<author><![CDATA[ oracle_user]]></author>
			</item>
	</channel>
</rss>