Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

manipulating 15+ million records in mysql with php?

I got a user table containing 15+ million records and while doing the registration function i wish to check whether the username already exist. I did indexing for username column and when i run the query "select count(uid) from users where username='webdev'" ,. hmmm, its keep on loading blank screen finally hanged up. I'm doing this in my localhost with php 5 & mysql 5. So suggest me some technique to handle this situation.

Is that mongodb is good alternative for handling this process in our local machine?

Thanks, Nithish.

like image 350
Nithish Avatar asked Jan 04 '11 05:01

Nithish


1 Answers

If you just want to check that it exists or not, try not using the count. Just a simple select username from users where username='webdev' LIMIT 1 may be faster.

ALSO, change the column type to varchar, if it's not already so. Don't user text type. It's much much slower.

like image 129
shamittomar Avatar answered Sep 21 '22 08:09

shamittomar