# `VERSION::7.1.0` Getting the Plan Digest for the `IndexJoin` Query

+ We execute the following query, and its execution plan is documented in `INFORMATION_SCHEMA.STATEMENTS_SUMMARY`

```
tidb> SELECT /*+ INL_JOIN(m, n) */ m.name, m.age, n.title FROM m, n WHERE m.id = n.id;
Empty set (0.00 sec)

tidb> SELECT * FROM INFORMATION_SCHEMA.STATEMENTS_SUMMARY WHERE QUERY_SAMPLE_TEXT = 'SELECT /*+ INL_JOIN(m, n) */ m.name, m.age, n.title FROM m, n WHERE m.id=n.id'\G;
*************************** 1. row ***************************
                SUMMARY_BEGIN_TIME: 2023-10-07 03:00:00
                 SUMMARY_END_TIME: 2023-10-07 03:30:00
                   STMT_TYPE: Select
                  SCHEMA_NAME: test
                    ~!@DIGEST: 11c39fac83c3a9205704b017466fda61177c57e38afe7728099bf8390a4593fe@!~
                  DIGEST_TEXT: select `m` . `name` , `m` . `age` , `n` . `title` from `m` , `n` where `m` . `id` = `n` . `id`
                  TABLE_NAMES: test.m,test.n
...
                        ~!@PLAN_DIGEST: 89ab72f95be8dda9488129b6c7d03f29410f49fcc129bdcbbe444d2b6d1bd455@!~
                    PLAN: id                 task      estRows     operator info
                    └─IndexJoin_15           root      12487.50    inner join, inner:TableReader_12, outer key:test.n.id, inner key:test.m.id, equal cond:eq(test.n.id, test.m.id)
                    ├─TableReader_36(Build)  root      9990        data:Selection_35
                    │ └─Selection_35         cop[tikv] 9990        not(isnull(test.n.id))
                    │  └─TableFullScan_34    cop[tikv] 10000       table:n,keep order:false, stats:pseudo
                    └─TableReader_12(Probe)  root      9990        data:TableRangeScan_11
                        └─TableRangeScan_11  cop[tikv] 9990        table:m, range: decided by [test.n.id], keep order:false, stats:pseudo
...
```
------------------------------------------------------------------------------
In this slide, the following SQL statement was executed:
```
SELECT /*+ INL_JOIN(m, n) */ m.name, m.age, n.title FROM m, n WHERE m.id = n.id;
```

Its execution plan is documented in `INFORMATION_SCHEMA.STATEMENTS_SUMMARY` as follows:

```
tidb> SELECT /*+ INL_JOIN(m, n) */ m.name, m.age, n.title FROM m, n WHERE m.id = n.id;
Empty set (0.00 sec)

tidb> SELECT * FROM INFORMATION_SCHEMA.STATEMENTS_SUMMARY WHERE QUERY_SAMPLE_TEXT = 'SELECT /*+ INL_JOIN(m, n) */ m.name, m.age, n.title FROM m, n WHERE m.id=n.id'\G;
*************************** 1. row ***************************
                SUMMARY_BEGIN_TIME: 2023-10-07 03:00:00
                 SUMMARY_END_TIME: 2023-10-07 03:30:00
                   STMT_TYPE: Select
                  SCHEMA_NAME: test
                    DIGEST: 11c39fac83c3a9205704b017466fda61177c57e38afe7728099bf8390a4593fe
                  DIGEST_TEXT: select `m` . `name` , `m` . `age` , `n` . `title` from `m` , `n` where `m` . `id` = `n` . `id`
                  TABLE_NAMES: test.m,test.n
...
                        PLAN_DIGEST: 89ab72f95be8dda9488129b6c7d03f29410f49fcc129bdcbbe444d2b6d1bd455
                    PLAN: id                 task      estRows     operator info
                    └─IndexJoin_15           root      12487.50    inner join, inner:TableReader_12, outer key:test.n.id, inner key:test.m.id, equal cond:eq(test.n.id, test.m.id)
                    ├─TableReader_36(Build)  root      9990        data:Selection_35
                    │ └─Selection_35         cop[tikv] 9990        not(isnull(test.n.id))
                    │  └─TableFullScan_34    cop[tikv] 10000       table:n,keep order:false, stats:pseudo
                    └─TableReader_12(Probe)  root      9990        data:TableRangeScan_11
                        └─TableRangeScan_11  cop[tikv] 9990        table:m, range: decided by [test.n.id], keep order:false, stats:pseudo
...
```

Here, we can record the `PLAN_DIGEST: 89ab72f95be8dda9488129b6c7d03f29410f49fcc129bdcbbe444d2b6d1bd455.`
Note that the `DIGEST: 11c39fac83c3a9205704b017466fda61177c57e38afe7728099bf8390a4593fe` represents the digest of the SQL statement and cannot be used for binding.