14

On all public Stack Exchange sites, questions and answers cannot be longer than 30,000 characters. One clear benefit to this limit is that users won't attempt to post tens of thousands of characters of log file data that no one in their right mind is going to sift through. However, with the fairly recent addition of Stack Snippets, I claim that there are some rare cases where a post above 30k characters is entirely legitimate.

Below are two of my recent Programming Puzzles & Code Golf questions. Both have been well received and both are very close to the 30k limit. One to two thirds of the characters in each are part of a Stack Snippet that is not meant to be read, only run.

The HTML/CSS/JavaScript in the Stack Snippets had to be minified to ensure I could fit the spec and rules into the post (I provide unminified JSFiddles).

While writing the second one, I was consistently just over the limit and had to tweak my language and formatting to stay under. (I'm aware I could golf down the minified snippet a fair bit, but as it just fits, I haven't bothered.)

Now I realize what I'm doing in these questions is very unique. Not many people on SE are writing Stack Snippets that run entire games. (Though I know my Red vs. Blue question inspired a number of derivatives.) But I've at least shown that there are cases where posting a lot of code that is not meant to be read can be legitimate, since running it in a Stack Snippet is the main purpose.

Therefore, is there no reason to not allow more than 30k characters in posts or posts with Stack Snippets? I realize there may be technical issues that put the fundamental limit at 32767 (215-1). If so, why not have that be the limit?

If avoiding bulky posts from new users is the only reason for the 30k limit, then it's not very useful, since a 10k character log file is not much easier to read through than a 30k one. Long, badly-formed questions of any length are just as easy to close.

More examples of long legitimate posts (feel free to add more):

(I'm not actually certain all SE sites have a 30k limit, but I'm assuming they do.)

  • 2
    You could always host the script elsewhere (perhaps even in another Stack Exchange post), and use it via a <script> tag. – Doorknob May 25 '15 at 15:43
  • 5
    @Doorknob That's true, but one of the main points of Stack Snippets was to avoid external links. – Calvin's Hobbies May 25 '15 at 15:46
  • They don't have to be external. This is quite an ugly and hackish workaround, but there could be a "Stack Snippets" question on meta.PPCG for which the answers are the excessively long snippets that don't fit in posts. Then you could use a <script src="..."> tag to include that answer in another post. – Doorknob May 25 '15 at 15:49
  • 2
    @Doorknob That might work, but as you say it's rather hacky and not an ideal solution. – Calvin's Hobbies May 25 '15 at 15:52
  • 1
    @Doorknob Update: I've actually been pretty successful having Snippets "point" to one another here. – Calvin's Hobbies May 25 '15 at 19:28
  • Seems excessively complicated—you can just link the script directly instead of having to use the API via <script src='...'></script>. Any reason why you chose to implement it that way? – Doorknob May 26 '15 at 0:58
  • 2
    Why were posts limited to 30k characters in the first place? – Rainbolt May 26 '15 at 13:12
  • @Rainbolt don't think it's technical restriction, more likely Jeff initially believed that more than 30k characters will be just a huge wall of text/code which is mainly noise and better be reduced to the relevant parts only. – ShaWiz Aug 17 '15 at 21:32
  • You think you'll get more or better answers if you're given even more hay in the questions in which to bury the needles? Frankly I'd be more open to reducing the limit. – Robert Longson Aug 17 '15 at 21:54
  • 2
    @RobertLongson many subjective decisions on Stack Exchange are made by voters rather than trying to set a single overarching rule. I think deciding which posts are too long should be based on looking at them through human eyes rather than measuring their characters. – trichoplax Sep 24 '15 at 7:00
6

This seems to not be a restriction of the database.

On Code Review, it seems the restriction has been doubled, as per @ChrisJester-Young♦'s comment:

I just upped the MaxBodySize limit, so you should be able to have the whole code in the question body. For Code Review, I believe it's important to have all the code in one place. :-) – Chris Jester-Young♦ 2 days ago

I just thought this should be mentioned...

  • 2
    Posts.Body is nvarchar(max) on all tables in the Data Explorer, so at least the column is wide enough for arbitrary expansion (well, up to 2^31-1 characters wide, anyway). – senshin Aug 17 '15 at 22:25
3

Limiting the result rather than the markdown

At present the 30,000 character limit applies to the markdown, rather than the rendered post. This means that links contribute to the total even if they are not displayed (only used to make a phrase into a link, or to display an image hosted elsewhere), as do markdown codes such as those used for headings, bold and italic text.

Would it be reasonable to make the 30,000 character limit apply to the rendered post instead? Since the post is rendered live while the markdown is being typed, the length of the resulting post should already be available for this purpose.

Since a Stack Snippet can optionally be included without displaying the code, this would allow for longer html/css/javascript while still preventing the readable parts of a post from going beyond 30,000 characters.

There could still be a somewhat higher limit for the markdown, if necessary to keep storage costs practical.

  • 8
    I don't believe the length of a rendered post is well defined. The length of the html could be used, but that's almost always going to be longer than the markdown. You'd need to define how many characters the Stack Snippet "Run Code" button counts as, for example. – Calvin's Hobbies May 25 '15 at 16:39
-2

There may be a reason beyond what has already been mentioned here for the 30k limit, and it can be seen using data.stackexchange.

When composing a query, you are shown the database schema. In the Posts table, the schema is this:

DB schema

The important part here is the Body column:

Posts.Body    NVARCHAR(MAX)

Note the MAX there. To me, that implies that the 30k limit is not a product of choice, but of storage restrictions in the database.

Whether this is a technical issue or not I don't know - an SE developer would have to tell us - but I felt it was worth bringing up.


Update: A comment left below tells me that NVARCHAR(MAX) can hold about a billion characters - so perhaps this isn't a limitation. Let's see what SE tells us.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .