Storing huge number of users in wordpress

In this pursuit, since the students could be thousands in a school, would it be a good practice to have so many entries in the wp_users table by creating a separate user_role : students’?

A separate user role will make no difference to site performance or scalability.

Or should I create a separate table to store the students’ login data?

This is a very bad idea.

Creating a separate table to store the user login data would just result in the same problem but in a new table. It would also instantly break 99% of plugins and require large rewrites of fundamental parts of WordPress core. The end result would have the same performance or worse, but have a very high development cost, and a large ongoing maintenance cost.

If you need to store data that doesn’t have a column in the user table, use user meta instead.


Thankfully the problem you’re asking about doesn’t exist until you reach user counts you’re unlikely to ever experience.

Are you expecting tens/hundreds of millions of active users? If so you will encounter other issues long before you ever reach that point. WP installations with user numbers of 9 figures do exist, at those levels the biggest obstacles are not the size of the user table ( though it does break pagination on the admin user listing ).

The one issue I do foresee, is if you want to display every user all at once on the same page without pagination. The problem however has nothing to do with the database. You can only receive so many database results at once before you run out of memory to store them in PHP, or time to generate the HTML and send it to the browser.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)