On the use of federated Index in mysql pagination Optimization with where condition

if the table table has a federated index (sex, id)
and id itself is the primary key
, does the following sql go to the index?

select * from table where sex="m" order by id limit 1000000,10

my feeling is that according to the execution order of sql
, we should first execute from table where sex="m", to filter out the result set, and then go to order by id, so I don"t feel like I"m going to index
, so I have to

.
select * from table in (select id from table where sex="m" order by id limit 1000000,10)

is that so?

Mar.16,2021

(1) SQL statement execution order:
SELECT

 FROM          --1
    WHERE    --2
      GROUP BY   --3
        HAVING      --4
           ORDER BY  --5
           

(2) if select queries only index fields, order by index fields will use the index, otherwise it will be arranged in the whole table;
(3) if there are where conditions, such as where sex='m' order by id, order by will also use the index!


Don't ask in an EXPLAIN, post?

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-1e4c595-44e85.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-1e4c595-44e85.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?