What's the maximum number of categories we can have?

I’m considering using Discourse as the backend for my website and app, but I haven’t seen any documentation on its scaling limits.

What’s the maximum number of categories we can have? Is it 1000? 10,000? 100,000?

I plan to heavily use the API and create a custom frontend for both web and mobile. Part of this is programmatically creating a new Category whenever a user wants to. So it’s more of a backend systems question than the UI.

For example, will the /categories.json endpoint scale? It doesn’t seem paginated.

Thanks!

500 to 1000 is safe

If you need more consider tags

Additionally you can have a very large number of groups

8 Likes

Thanks @sam! Follow up question – what would the approximate limits be for:

  • the number of tags
  • the number of topics in a category

For example, can I have a few million unique tags, as well as a few million topics within a single category?

The tags, topic_tags, and topics tables don’t appear to be sharded, which should work for a few million rows, but I haven’t looked into the queries themselves, nor any UI that could potentially break.

1 Like

Is there a table somewhere showing this kind of information?

The default post size is 32000 characters, for example, but what is the absolute max, what is the practical max?

1 Like

Hi! Just wondering if you found the answer to this? Specifically I’m also wondering about the max number of tags.

Determining a “maximum” depends on what you consider to be the limiting factor.

I don’t see a problem with PostgreSQL
PostgreSQL: About

Maximum Table Size 32 TB

Even with optimal indexing, query speeds will at some point take “too long”. What that is will vary from person to person.

Then there’s Ruby, Ember, bandwidth and browser limits. Feel free to research, but I wouldn’t worry about those.

I think that long before any software limits are reached “sane” limits will have already been passed. And what that would be will vary from person to person and how they interact with the information.

tl;dr You will break your users long before you break any code.

5 Likes

I have 2500 categorys and my demand up to 3000 category, can i continue?

Personally I never subscribe to a site that has 2500 categories.
Virtually you can create all the categories you want but your site will only be confusing and not navigable.

Note that an official answer has already been given to your question and also an alternative to using categories.

5 Likes

The problem of categories in the first place is the problem of transparency and navigation for users. Working previously on the catalogue dmoz.org and making categories for Russian directories, we are faced with the fact that with a large number of categories, problems arise in users. A large number of categories, it’s like there are no more categories. They become unnecessary, impossible to use. Nobody understands the structure of the site, including those who did it. I think that’s the problem.

Navigation should be navigation, and if it loses its functions, it is sad.

5 Likes

UI considerations aside, I’m curious what happens when you get up into the 1000+ categories range. Would responses just take a little bit longer on average, or are there catastrophic consequences? Is this something that can be solved by throwing better hardware at the problem?

Like the OP, I’m working on a project that could easily have 1000s of categories. It uses group based permissions heavily and an individual user may only be able to see a handful (this is why I can’t use tags). So I’m not worried as much about the UI being overwhelming, but would like to know what the bottleneck is at that higher range.

3 Likes

Honestly probably nothing terrible, unless you are admin and have access to 1000+ categories. At that point we would ship you every single category json in your first page, the categories page would get slow both server side and client side.

8 Likes

Relating to this:
If I have 100s to 1000s of categories, is there an option for me to limit the number of search results?
My problem: Due to a large number of categories, clicking on the dropdown when creating a new topic, or searching for categories when subscribing to them, has a long delay (10s of seconds).

I know we have an option to restrict the number of results in such scenarios to tags. Do we have/can we have the same for categories?

Hi @Tayyab_Anwar

I just checked the DB for you and there are no settings related to restricting categories (for searches) in the DB.

There are some restrictions in the UI available (as you know):

So, it looks like you would need to create a plugin to add extra features to restrict search results based on categories and related criteria.

Hope this helps.

Can you share some numbers regarding the resources you need for hosting?
How much RAM, CPU are you normally using.

Also, how is the user experience, how fast does it load - are there bottlenecks in some areas?

I’m asking because I want to secure conversations between patients and medics:

I have a site with over 500 categories (if I recall correctly). I think it was doing ok on an $80/month cpu optimized droplet with about 250k page views per month.

4 Likes

Can you share your latest impressions of using so many categories?

  • How many categories do you currently have?
  • Do all users have so many categories or is the access restricted and only admins have access to all cats?
  • Do you have changed the discourse code or added some other tweaks?

Thanks in advance.

Interested to know how posting new topics works with so many categories?

The New Topic button on the homepages (Categories, Latest, New) requires you to select a category, unless you allow uncategorised posts. Selecting a category in the drop down seems impractical with so many in the list. How do you deal with that aspect?

I have 300+ (with a lot of sub cat though), but the admin is the only one to see that much.
You can search within the drop down, but you have to know beforehand the name of the category you want to post in.
The main “issue” for me would be to scroll to a far down category on the homepage (easily fixed by using the search feature)

2 Likes

I’m interested in this as well. My community is amateur radio operators, and there are 1000s of small local clubs. I would like to offer each local club their own private group to discuss club matters potentially.

It would probably be a long time before I hit any limits. I imagine I would probably hit a maximum of about 500 groups at full capacity, each with its own category.

These groups would only be displayed to users who were added to the club via API.

So (mostly) all categories are private and available only to members of the group? I’m not sure, but I think that solves much of the performance issues and if you think you’ll stay at about 500 you might be on even if I’m wrong. I think about 200 is what’s the recommended max, but I have a site with 200 or 300. And you’ll have warning so you could split them off into multiple instances of your numbers get too big.

1 Like