Summary:
Original commit: 33ee227d820588b0cc47d31607c3ba9bb66a8282 / D43797
During query execution, stats such as read requests and rows read are collected and assigned to plan nodes. At the start of query execution, those stats need to be reset to discard any instrumentation from before that query began (e.g. catalog requests). That was done by the following lines in `explain.c`:
```lang=c
/* YB: Refresh the session stats before the start of the query */
if (es->rpc)
{
YbRefreshSessionStatsBeforeExecution();
}
```
Prior to the diff that added tracking for rows removed in PGGate (D43219 / 5e2396948a32), this was sufficient, because only the `DIST` related stats needed to reset. With D43219 because collecting + printing out the number of rows removed by PGGate's index recheck occurs during any `EXPLAIN (ANALYZE)` query, so the stats must be reset before any `EXPLAIN (ANALYZE)` query, not just any `EXPLAIN (ANALYZE, DIST)` query.
Jira: DB-16580
Test Plan:
```
./yb_build.sh --java-test TestPgRegressIndex
```
Before applying the fix, the new test output was:
```
QUERY PLAN
-----------------------------------------------------------
Index Scan using idx_col3 on test (actual rows=0 loops=1)
Index Cond: (col3 = ANY ('{}'::integer[]))
Rows Removed by Index Recheck: 21255
(3 rows)
```
Since this query never actually sends a request, the recheck line is obviously wrong.
After the fix, the recheck line is gone.
Reviewers: kramanathan
Reviewed By: kramanathan
Subscribers: yql
Differential Revision: https://phorge.dev.yugabyte.com/D43853