I'm trying to grab the most recent event for each 'lead'. I have created indexes and this query still will take well over 30 minutes. 

```
SELECT  l.id,
        l.home_number,
        l.mobile_number,
        CASE WHEN l.soldprice < 2 THEN 0 ELSE 1 END as sold,
        l.lead_date
FROM (
    SELECT  l.home_number, MAX(l.id) as id
    FROM lead l
    WHERE l.lead_date >= DATE_SUB(NOW(), INTERVAL 52 WEEK)
    AND l.state NOT IN ('NY','AR','VT','WV','GA','CT','DC','SD')
    GROUP BY l.home_number) a 
JOIN lead l ON l.id=a.id;

```

My table indexes are below:

```
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_typ    
lead    0   PRIMARY     1   id          A   63123648    NULL    NULL        BTREE       
lead    1   id          1   id          A   63266540    NULL    NULL        BTREE       
lead    1   soldprice   1   soldprice   A   14715       NULL    NULL    YES BTREE       
lead    1   lead_date   1   lead_date   A   15351477    NULL    NULL    YES BTREE

```

And my table schema:

```
CREATE TABLE lead
( 
  id                BIGINT unsigned NOT NULL, 
  lead_date         DATETIME NULL,
  first_name        VARCHAR(50) NULL,
  last_name         VARCHAR(50) NULL,
  hashed_ssn        VARCHAR(34) NULL,
  city              VARCHAR(50) NULL,
  state             VARCHAR(2) NULL,
  home_number       VARCHAR(10) NULL,
  mobile_number     VARCHAR(10) NULL,
  email             VARCHAR(255) NULL,
  soldprice         DECIMAL(5,2) NULL,
  requested_amount  INT NULL,
  time_zone         VARCHAR(5),
  camp_id           VARCHAR(9),
  leadtype_id       VARCHAR(3),
  hittype_id        VARCHAR(3),
  PRIMARY KEY       (id)                           
);

```

Any suggestions would be greatly appreciated.

EDIT: I'm using MySQL version 5.7.19-0ubuntu0.16.04.1