I just want to know how to get the key size of a composite index? It states in the “Best Practices” that a composite index should have a combined field size of 1KB. How will I know if the fields on the composite index already exceeds 1KB?
13. Avoid large keys to index
Prior to 5.0, there was a limitation on the key size for indexes(maximum 4k). This limitation has been removed in 5.0. It should be noted that indexes are meant for data access path and hence the data model and query(with indexes) should be structured to get the necessary information in shortest time. Though customers can have any number of fields in a composite index, the index key size also grows proportionally. Really large key size might impact performance. As a general rule of thumb, prefer to have 1kB as the combined size of all fields in a composite index; and if that is not possible, refactor the queries suitably.