Optimize 2.3.0 pre-upgrade check queries (#23458)
Optimize 2.3.0 pre-upgrade check queries (#23458)

We have to check for rows that are missing either corresponding TI or DR and move them out of table before adding FKs.  We were doing correlation in the JOIN condition but it appears postgres does *not* like this so here we move correlation to WHERE.
Acehaidrey/incubator-airflow,Acehaidrey/incubator-airflow,nathanielvarona/airflow,danielvdende/incubator-airflow,apache/airflow,nathanielvarona/airflow,apache/airflow,nathanielvarona/airflow,Acehaidrey/incubator-airflow,danielvdende/incubator-airflow,danielvdende/incubator-airflow,apache/airflow,nathanielvarona/airflow,cfei18/incubator-airflow,Acehaidrey/incubator-airflow,Acehaidrey/incubator-airflow,nathanielvarona/airflow,danielvdende/incubator-airflow,cfei18/incubator-airflow,cfei18/incubator-airflow,apache/airflow,Acehaidrey/incubator-airflow,danielvdende/incubator-airflow,cfei18/incubator-airflow,cfei18/incubator-airflow,apache/airflow,apache/airflow,danielvdende/incubator-airflow,nathanielvarona/airflow,cfei18/incubator-airflow