[SERVER-80410] Improve "Index key pattern too large" error message when more than 32 fields used in creating a compound index Created: 24/Aug/23  Updated: 03/Nov/23

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: James Lin Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: car-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File createindex-toolarge.nosql    
Assigned Teams:
Catalog and Routing
Participants:
Case:
Story Points: 2

 Description   

In most recent MongoDB releases (e.g. 5.0+), "Index key pattern too large" error message will be received if there are more than 32 fields when creating a compound index. This is due to documented limit in Number of Indexed-Fields in a Compound Index.
 
For example, if running the createIndex command from createindex-toolarge.nosql file, it will fail with an error message "...caused by :: Index key pattern too large".

The error message is not obvious to a user who run the create index command what goes wrong and often the user will mistakenly think the other limit 1024 byte index limit which has been resolved since 4.2. This can cause confusion.

We can improve the error message to be more direct and explicit, like "caused by :: Index keys (fields) exceeded the limit (32) for the number of indexed fields" or something similar.


Generated at Thu Feb 08 06:43:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.