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

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

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

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

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

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

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

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

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

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

私もこれに興味があります。私のコミュニティはアマチュア無線オペレーターで、何千もの小さなローカルクラブがあります。各ローカルクラブに、クラブの事項について話し合うための独自のプライベートグループを提供したいと思います。

おそらく、制限に達するまでにはかなりの時間がかかるでしょう。満員になった場合、おそらく最大で約500のグループに達し、それぞれに独自のカテゴリがあると思います。

これらのグループは、API経由でクラブに追加されたユーザーにのみ表示されます。

したがって、(ほとんど)すべてのカテゴリがプライベートであり、グループのメンバーのみが利用できるということですか?よくわかりませんが、これでパフォーマンスの問題の多くが解決されると思います。もし500人程度で維持できると考えているなら、たとえ私の考えが間違っていても大丈夫かもしれません。推奨される最大数は200人だと思いますが、私は200人または300人のサイトを持っています。そして警告が表示されるので、数字が大きくなりすぎた場合は、複数のインスタンスに分割することができます。

「いいね!」 1