There is a sentence in the MySQL document that I don't quite understand.

in the
mysql document:
https://dev.mysql.com/doc/ref.

I don"t quite understand some of the following sentences. I"d like to ask you for help

The index may also be used even if the ORDER BY does not match the index exactly, as long as all unused portions of the index and all extra ORDER BY columns are constants in the WHERE clause. If the index does not contain all columns accessed by the query, the index is used only if index access is cheaper than other access methods.

how to understand the sentence "as long as"?
my personal understanding is:

as long as the columns that do not appear in order by and the columns that do not appear in order by are constant in the where statement, do you mean that columns that do not appear in the index are constant in the where statement

especially the extra order by column in all extra ORDER BY columns .

Mar.18,2022

SELECT * FROM t1
  WHERE key_part1 = constant
  ORDER BY key_part2;

here all extra ORDER BY columns are constants in the WHERE clause actually means that the key_part1, official document interprets the key_part1 from different angles. It is an extra column for an index that is dead, and an extra column for order by. Can understand when the index can be used to optimize sorting.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf5392-312ba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf5392-312ba.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?