MySQL optimization - Difference between WHERE on VARCHAR and on MEDIUMINT
I've been needing to do a lot of optimization on mysql queries and 开发者_开发知识库I am considering reworking queries on a user's account so that instead of performing a query "WHERE username = a varchar" I am thinking about "WHERE user_id = a number." I've been looking into this, but am wondering if it would it be worth the effort to go through all the changes to the system for this improvement?
It depends if you have an index on either of the columns, because creating an index is a way of optimization. however , updating a table with indices takes more time than updating a table without and index : check simple explanation here
精彩评论