# Learning Background Of Aggregation Operation Case

+ Table definition:
+ Statistical statement:

```12
CREATE TABLE t1 (
 id int(11) NOT NULL AUTO_INCREMENT,
 orderid int(11) NOT NULL,
 addr int(11) NOT NULL,
 dt datetime NOT NULL,
 PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;


SELECT count(*) FROM t1 WHERE dt > '2021-11-25 20:39:58' 
```

------------------------------------------------------------
Case background

Our online databases often encounter the need to perform aggregation operations such as count on database records. Let's take a look at how to tune and solve these SQL performance problems.

Specific case

We have a t1 table with the following table schema:

```
CREATE TABLE t1 (
 id int(11) NOT NULL AUTO_INCREMENT,
 orderid int(11) NOT NULL,
 addr int(11) NOT NULL,
 dt datetime NOT NULL,
 PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
```

We need to count the number of records from a certain point in time to the present: select count (*) from t1 where dt>'2021-11-25 20:39:58 '. Let's look at the execution plan:
