Overflow sort stage buffered data usage of 33556087 bytes exceeds internal limit of 33554432 bytes

Hi and good day,

i just encountered the error above after i created an index to improve the query performance of a certain collection. field A has a string value and field B has a boolean. I created a compound index for the said fields since it is identified that querying the said field takes a 5 second duration.

as per checking on the query it is not using a sorting criteria also

Should i advise the development to use a sorting field and declare it on the index that will be created to avoid this error ?

Hi @Daniel_Inciong

I think this is an old error message that signifies that your query has an in-memory sort that exceeds 32MB. See sort operation limits for more details.

The last version that I can find this exact message was MongoDB 3.0.15, which was released in 2017. Could you confirm the MongoDB version you’re using?

With regard to this specific error, later versions of MongoDB extends this limit to 100MB. However, the main reason for this error is the use of sort() and the lack of index that can be used to perform that sort, so the server was forced to sort in-memory instead.

To mitigate this, please see Use Indexes to Sort Query Results.

Note that MongoDB 3.0 series was out of support since Feb 2018, so I would strongly recommend you to upgrade to a supported version.

Best regards
Kevin

3 Likes

hi kevinadi,

MongoDB version is 2.6.12

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.