Reputation: 806
I use varchar for saving barcode in my database and the index is set for this field for better result in search. But the response time is a bit longer and we need to decrease the result time.
Upvotes: 1
Views: 4386
Reputation: 4451
If you already have an index on that field, the query should be as fast as it can be. Take a look at this answer. Just make sure that MySQL is choosing that index.
Of course, if your barcodes are always of the same length you would be better off with a Char(N) datatype.
Upvotes: 2