php - how to increase performance of mysql query? -


I have already used a username to use this query or I am using Ajax in the database, so far I will record a lot in the Future Username list in only a few DB BTs, so I want to improve the performance of the query in such a way that it will take less time to check the username.

How can I improve the following questions? Is it possible to index on DB?

  check.php & lt ;? Php if (isset ($ _ POST ['user_name'])) {$ user_name = $ _ POST ['user_name']; Included ("include / conn.php"); $ Sql_check = mysql_query (Choose user id from "vector`, where userid = '". $ User_name. "'") Or die (mysql_error ()); If (mysql_num_rows ($ sql_check)> 0) {echo "no"; } Else {echo "yes"; }}? & Gt; My jquery code & lt; Script language = "javascript" & gt; $ (Document) .ready (function () {$ ("# uname"). Blur (function () {$ ("# msgbox"). RemoveClass (). AddClass ('messagebox'). Text ('checking. Fidine ("slow"); $ .post ("check.php", {user_name: $ (.) .val ()}, function (data) {if (data == 'no') // If no username Available {$ ("# msgbox"). Feedto (200,0.1, function {$ (this) .HTML ('This user name already exists') AddClass ('messageboxerror'). Feedto (900, 1);});} and {$ ("# msgbox"). Feedto (200,0.1, function {$ (this) .html ('username is available to register'). AddClass ('messageboxok '). FadeTo (900,1);})}});});}); & lt; / scripts & gt;  

Yes, you should probably add an index to the user-field field. Something like this will appear:

  Alternate table 'vector`. `` `` `` `` `` `` >: You can use this line in the MySQL console when you are connected to the database. If you are using PHPMyAdmin, then it also supports adding indexed to their GUI.   

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -