Re: what would a c extension buy me

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



joseph wrote:
> sorry, i made a mistake before.
> 
> 
>>>                   9795 Query       select
>>>word,def,wordid,pos,posn,wordsize,syn from  korean_english where word
>>>like '운전할'  order by wordsize desc
>>
>>in cases when you are not using the wildcard tokens (percentage signs)
>>try changing the query to use something like:
>>
>>	... word = '운전할' ...
>>
> 
> 
> i have to stick with 'like' because it matches case-insensitive, else
> the first word of a sentence (with a capital letter) doesn't match the
> db word.  FYI

do you really care about case (in languages where characters even have case)?
if not stick everything into the DB as uppercase and test against that (always normalizing
everything to uppercase before doing the queries). it would be faster than a
case-insensitive search

also consider it might be worth creating a special index for the first (couple?)
of letters of the WORD field, that would allow something like this (not in all cases obviously):

	SELECT * FROM korean_english WHERE word = '운전할' AND SUBSTR(word,0,1) = '운'

(now I'm allowed to sue 'SELECT * ...' because I'm offering a possible
concept/idea - as opposed to pasting code for people look at) - basically the idea
entails creating an index (possibly based on an extra column) that would allow the
mysql engine to start searching in a smaller subset based on the 2nd (in this case)
WHERE clause and using the more compact 'SUBSTR(word,0,1)' index.

this might not have any effect whatsoever depending on how indexes are used
internally by the mysql engine. so basically this is me guessing :-)


> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux