Aleksejs Posted June 2, 2008 Report Share Posted June 2, 2008 Pamēģini to pašu vaicājumu (ar Latvia) tikai bez ORDER BY daļas. Vai mainās izpildes ātrums? Link to comment Share on other sites More sharing options...
bubu Posted June 2, 2008 Report Share Posted June 2, 2008 Vai tad LIKE māk izmantot indeksus? Link to comment Share on other sites More sharing options...
Aleksejs Posted June 2, 2008 Report Share 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. Link to comment Share on other sites More sharing options...
nekonezinu Posted June 2, 2008 Author Report Share Posted June 2, 2008 Latvia 73.4716560841 Antartic 74.7929170132 Kverija: SELECT * FROM vardi WHERE vards LIKE'$s%' Link to comment Share on other sites More sharing options...
Aleksejs Posted June 2, 2008 Report Share Posted June 2, 2008 Un ja ar mazo burtu uzraksta? latvia un antartic Link to comment Share on other sites More sharing options...
nekonezinu Posted June 2, 2008 Author Report Share Posted June 2, 2008 Nekas nemainījās Link to comment Share on other sites More sharing options...
Aleksejs Posted June 2, 2008 Report Share 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%'; Link to comment Share on other sites More sharing options...
nekonezinu Posted June 2, 2008 Author Report Share 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 ) Link to comment Share on other sites More sharing options...
Klez Posted June 2, 2008 Report Share Posted June 2, 2008 nekonezinu, tev phpMyAdmin nav pa rokai ? veel buutu labi ja paraadiitu tabulas struktuuru ... vai vismaz sho: SHOW INDEX FROM vardi Link to comment Share on other sites More sharing options...
Aleksejs Posted June 2, 2008 Report Share Posted June 2, 2008 Hmm, un cik ātri šitāda izpildās: SELECT * FROM vardi WHERE MATCH (vards) AGAINST ('Latvia') ? Link to comment Share on other sites More sharing options...
nekonezinu Posted June 2, 2008 Author Report Share 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 Link to comment Share on other sites More sharing options...
andrisp Posted June 2, 2008 Report Share Posted June 2, 2008 nekonezinu, a tev taada tabula "vardi" vispaar ir ? :) Link to comment Share on other sites More sharing options...
nekonezinu Posted June 2, 2008 Author Report Share Posted June 2, 2008 Protams ka ir! Link to comment Share on other sites More sharing options...
andrisp Posted June 2, 2008 Report Share Posted June 2, 2008 mysql_error() Link to comment Share on other sites More sharing options...
nekonezinu Posted June 2, 2008 Author Report Share Posted June 2, 2008 Can't find FULLTEXT index matching the column list Link to comment Share on other sites More sharing options...
Recommended Posts