I am looking for ideas on how to log user's login IPs without compromising on performance in MySQL.
There are few primary tasks which the log would be used for:
- Finding list of other users who have similar IPs (almost every time a user logs in)
- Finding names of users with same IP
- Finding all IPs used by the user and showing side by side other users who have similar IPs. (mainly to track ban-evaders) (by similar, I require at least 2 bytes of the IP to match)
- Finding most recently used IP by a user when he is offline (was thinking if it would be better to add an IP column in the users table for each user)
Every user has a unqiue id known as database-id which is a number.
I need ideas on how to implement before I begin with the main focus on maximizing performance of the tasks mentioned above.