Aleksejs Posted June 2, 2008 Report Posted June 2, 2008 Pamēģini to pašu vaicājumu (ar Latvia) tikai bez ORDER BY daļas. Vai mainās izpildes ātrums?
Aleksejs Posted June 2, 2008 Report Posted June 2, 2008 Dažkārt māk: The index also can be used for LIKE comparisons if the argument to LIKE is a constant string that does not start with a wildcard character. For example, the following SELECT statements use indexes: SELECT * FROM tbl_name WHERE key_col LIKE 'Patrick%'; SELECT * FROM tbl_name WHERE key_col LIKE 'Pat%_ck%'; In the first statement, only rows with 'Patrick' <= key_col < 'Patricl' are considered. In the second statement, only rows with 'Pat' <= key_col < 'Pau' are considered. The following SELECT statements do not use indexes: SELECT * FROM tbl_name WHERE key_col LIKE '%Patrick%'; SELECT * FROM tbl_name WHERE key_col LIKE other_col; In the first statement, the LIKE value begins with a wildcard character. In the second statement, the LIKE value is not a constant. If you use ... LIKE '%string%' and string is longer than three characters, MySQL uses the Turbo Boyer-Moore algorithm to initialize the pattern for the string and then uses this pattern to perform the search more quickly.
nekonezinu Posted June 2, 2008 Author Report Posted June 2, 2008 Latvia 73.4716560841 Antartic 74.7929170132 Kverija: SELECT * FROM vardi WHERE vards LIKE'$s%'
Aleksejs Posted June 2, 2008 Report Posted June 2, 2008 Un ja ar mazo burtu uzraksta? latvia un antartic
Aleksejs Posted June 2, 2008 Report Posted June 2, 2008 parādi, ko abos gadījumos iedod EXPLAIN EXPLAIN SELECT * FROM vardi WHERE vards LIKE 'Latvia%'; EXPLAIN SELECT * FROM vardi WHERE vards LIKE 'music%';
nekonezinu Posted June 2, 2008 Author Report Posted June 2, 2008 Latvia: Array ( [id] => 1 [select_type] => SIMPLE [table] => vardi [type] => range [possible_keys] => vards_in [key] => vards_in [key_len] => 765 [ref] => [rows] => 1 [Extra] => Using where ) music: Array ( [id] => 1 [select_type] => SIMPLE [table] => vardi [type] => range [possible_keys] => vards_in [key] => vards_in [key_len] => 765 [ref] => [rows] => 5 [Extra] => Using where ) dvdrip: Array ( [id] => 1 [select_type] => SIMPLE [table] => vardi [type] => range [possible_keys] => vards_in [key] => vards_in [key_len] => 765 [ref] => [rows] => 2 [Extra] => Using where )
Klez Posted June 2, 2008 Report Posted June 2, 2008 nekonezinu, tev phpMyAdmin nav pa rokai ? veel buutu labi ja paraadiitu tabulas struktuuru ... vai vismaz sho: SHOW INDEX FROM vardi
Aleksejs Posted June 2, 2008 Report Posted June 2, 2008 Hmm, un cik ātri šitāda izpildās: SELECT * FROM vardi WHERE MATCH (vards) AGAINST ('Latvia') ?
nekonezinu Posted June 2, 2008 Author Report Posted June 2, 2008 $aax = mysql_query("SELECT * FROM vardi WHERE MATCH (vards) AGAINST ('Latvia')"); while ($col = mysql_fetch_assoc($aax)){ echo $col['skaits']; } Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
andrisp Posted June 2, 2008 Report Posted June 2, 2008 nekonezinu, a tev taada tabula "vardi" vispaar ir ? :)
nekonezinu Posted June 2, 2008 Author Report Posted June 2, 2008 Can't find FULLTEXT index matching the column list
Recommended Posts