Jump to content

Database Search Optimization


Recommended Posts

If I have a code that regularly searches a database with tens of thousands of entries (lets say it's a users database) would it be quicker to search by INT or VARCHAR or does it matter?

SELECT * FROM users WHERE id=6468


SELECT * FROM users WHERE username='testuser'

I would imagine that the first would be much quicker.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...