should i use a database to store online users

i am building a chat app i am using socket io ,express js i am hesitant whether i should store the current online users in an array or store them in a database i thought of the first option because i don't wanna use alot of space from my database i am using mysql and most free options don't offer much storage these days + everytime a user logs in i would need to make a call to the database , also i am not sure if it's a good idea to store the users in an array what if i have 10k users i would have to loop over them if i want to find a specific user
Was this page helpful?