I created a system which hopefully will have many users. We are afraid our user database will be filled by "trash users" which take high-demand usernames, or maybe they just register and never come back.

I know this is common, I do this myself, as I have 3 google accounts, but I only use 1. How can a large website manage trash users or never coming back users like this?

  • 12
    I think the question needs a little bit of clarification. What exactly is a "trash user"? Do you mean an inactive account or what? Are you sure this question is really about software development?
    Commented Aug 7, 2015 at 8:31
  • oh sorry, may be its habit in my education, my everyone said every data not used is trash, trash user is like some user data never used again and make redundant Commented Aug 7, 2015 at 13:58
  • 6
    So you are fearful that a new user will not register for your site once they see that FrankIsAwesome is taken? This should not keep you up at night. What keeps me up at night is the thought that FrankIsAwesome might be heavily active for one year, inactive for 2 years, have his account removed and registered by another user which can now pose as the original FrankIsAwesome. You can try the StackOverflow approach and link everything to an ID and allow the user to change their name every 30 days (I believe) to something which is available.
    – MonkeyZeus
    Commented Aug 7, 2015 at 14:56
  • 3
    @MonkeyZeus I'm pretty sure StackOverflow names need not be unique...
    – Michael
    Commented Aug 7, 2015 at 16:09
  • 3
    @MonkeyZeus The unique StackExchnage is the id number which is per site - look at the address of a user's profile page. The user name is not used as a key (my username is not unique and I have had several comment chains with another Mark)
    – mmmmmm
    Commented Aug 7, 2015 at 20:14

5 Answers 5


Some services remove accounts that have not seen any activity in a certain amount of time, say, a year.

Others don't bother, on the ground that keeping a user record in their system is a trivial amount of data and who knows, they may come back.

Of course if you're keeping track of what users actually do with your service removing them is rather tricky. Either you're going to have to remove everything they contributed to as well or find some way to unlink all that from their account (which may not be a good thing to do for a variety of reasons, attribution, legal hassles, etc.).

And if the users actually had to pay for content that's accessible through that inactive account, removing the account is not a good thing at all as you're now depriving people of things they actually spent good money on (Linden Lab had to change their policy regarding Second Life users because of that, they used to remove inactive accounts after a period but had to stop doing so when people complained that they were being deprived of their investment, and rightly so, when some people returned after prolonged absences due to for example temporary placement overseas (expats, military, etc. etc.).

Best you can probably do is not to bother. Second best would be to only remove accounts that not only have seen no activity for a long time but also have contributed nothing and have nothing linked to them at all.

  • yeah, i want to keeping track of what users actually do, i just dont want delete user, thanks for your suggestion Commented Aug 7, 2015 at 15:03
  • oh yeah how about if i create a server or db for "trash data may be used" so actually when i delete, it will transfer to that db or server. so i can open that user to others and also have record about that trash data. in this era all data may be can be important i think. just my opini as newbie Commented Aug 7, 2015 at 15:05
  • +1 for "Best you can probably do is not to bother." I've seen sites that don't bother. The rationale is that they don't have to deal with users who disappear for a few years, then suddenly come back on a whim and are irritated when their log-in info no longer works. By leaving the user names alone, you'll save yourself and your users some hassle. (Plus, StackOverflow seems to work fine without requiring unique user names.)
    – Kyralessa
    Commented Aug 24, 2015 at 19:33
  • I would add "and only on demand" to second best. Commented Jan 27, 2020 at 23:29

Weirdly, Facebook or Google have so many users that this isn't much of a problem for them.

Whoever picked a really desirable username (e.g. "Frank") probably already did so back in 2008. The many, many users who now come and want to try it, never to come back, will probably have to be content with "Frank32183" instead, and once you accept that, there is no particular reason why you wouldn't accept "Frank32184" just as well (not everyone can be so lucky to have a unique name, like me!).

Another factor is that, famously, big data companies never remove user data unless both public opinion and a court/law really, really urgently tell them to, because their user data is their business model. Being able to say "we have 3,000,000,000 users" is more important than ensuring that they are all live users, because it attracts more new users, plays better with advertising customers, etc. Keeping users happy is important to the company, but not quite as important as keeping them in the first place.

In a smaller, more familiar network the trade-offs may be different. Indeed, actually removing your data without a trace might be a valuable unique selling point of an exclusive online platform. But the really big companies who aim to have everyone on the planet as their customer simply don't operate in that space.

  • 4
    "a court/law really, really urgently tell them to," and even then they often don't, just make the data inaccessible to the end users while retaining it for their own use...
    – jwenting
    Commented Aug 7, 2015 at 12:51

Separate login credentials from display names

Allow users to log in with their email address or existing account from a site which provides such a service (e.g. Google or Facebook). If you really want to have users come up with a new username, that works, too.

Then, before interacting with the system further (or as part of registration), ask users to pick a display name. Since this name is separate from login credentials, you are free to reclaim it if the user becomes inactive and can, upon their return, make them select a new name. As a bonus, you can let users change their display name at will.

This does not work as well (but isn't really all that bad) for systems where you are saving long-term discussions between many users - it can be difficult to parse a conversation between a handful of users a few months or years later when two of them have gone inactive and lost their display names (replaced with inactive user #123 and #186 respectively) but have still referred to their old names in text. It can also lead to users impersonating each other, though there are many strategies to combat this.

This is not a very novel idea. Stack Overflow does the separation (though I don't think names are ever reclaimed or even unique), several online games also implement the reclamation aspect.


This is more of a UX problem, rather than a programming problem.

But the solution is simple: don't use the user's username as their display name. Basically every major service uses this method: Stack Exchange, Google, Youtube, Steam, everything.

This comes with two major advantages:

1) Users can choose whatever name they want, even if it's already taken. Duplicate users don't usually cause any confusion since users typically have avatars or IDs.

2) Security. You're not telling your username to the world, begging people to bruteforce your account.

  • 2
    this seems to merely repeat point made and explained in a prior answer, "Separate login credentials from display names..."
    – gnat
    Commented Aug 7, 2015 at 19:41

When an account is inactive for a long time send them an email notifying them that their account will be deactivated in a few month. On deactivation clear the user name and send a reset link by email.

The next time the user wants to log in make him choose a new name. He needs to use the reset link to choose a new name.

That way all users can keep their data but idle names are made available eventually.

Not the answer you're looking for? Browse other questions tagged or ask your own question.