Hello friends, I'd like to know if someone can help me.. Ie: Case A - Table with 1000000 fields. - Id_company INT(5) - Index Id SELECT * FROM TABLE WHERE id_company = 1 Case B - Table with 1000000 fields. - company varchar(100) - Index company SELECT * FROM TABLE WHERE company = 'company_name' What is faster A or B ? Is better use INT than varchar? Best regards and thanks for your time, Jakomo
Int(5) would most likely be faster than varchar(100). Make sure you have an index on the column in the where clause in either case. You can also test yourself by making a simple test script. Get the time before the query starts and the time after and calculate the difference between them. Also, if you don't need negative numbers an unsigned smallint(5) should be faster than int.
use (int) and list column names out if you dont truly need all of them. Your question asks about a join, but I dont see one in your query.