List:General Discussion« Previous MessageNext Message »
From:Colin McKinnon Date:October 13 1999 10:43am
Subject:Re: Trying to make queries faster
View as plain text  
At 13:59 09/10/99 GMT, Steven Fletcher wrote:
>Hi all.
<snip>
>mysql> Select * From companies Where ((type like 'museum%') ) AND ( add1
>LIKE 'salford%' OR add2 LIKE 'salford%' OR add3 LIKE 'salford%' OR add4
>LIKE 'salford%' OR district LIKE 'salford%' OR town LIKE 'salford%' OR
>county LIKE 'salford%' ) limit 50;
<snip>

This is totally Off Topic since its a question about database design rather
than MySQL.

Its difficult to optimize all those LIKE clauses, also MySQL has trouble
coping with ORed conditions. You have a lot of indices which will never get
used by queries like this.

Try forcing a little more structure on your address e.g.:
	number_in_street,
	street_name,
	locality,
	town,
	county,
	country,
	postcode

Also, since you already have a large dataset which isn't in this form, try
searching on a range of postcodes. Don't use wildcards.

HTH

Colin




Thread
Trying to make queries faster(Steven Fletcher)9 Oct
  • Re: Trying to make queries fasterTonu Samuel10 Oct
  • Re: Trying to make queries fasterJan Dvorak12 Oct
    • Re: Trying to make queries fasterMichael Widenius12 Oct
  • Re: Trying to make queries fasterColin McKinnon13 Oct