I'm running below query with set explain on.
QUERY: (OPTIMIZATION TIMESTAMP: 08-12-2021 18:44:05)
------
select count(*) from cs_subr_pcn_00 cb
WHERE EXISTS (SELECT cl.cust_numb , cl.subr_numb from cs_cust cs, cs_clse_cust cl
WHERE cs.cust_numb = cl.cust_numb
AND cl.cust_numb = cb.cust_numb
AND cl.subr_numb = cb.subr_numb
)
{
select count(*) from optim_cs_subr_pcn_00;
select count(*) from cs_subr_pcn_00;
select count(*) from optim_cs_cust_srch_09;
select count(*) from cs_cust_srch_09;
}
Estimated Cost: 14248124
Estimated # of Rows Returned: 1
1) informix.cb: INDEX PATH
(1) Index Name: informix.neo_csp_subr02_00_01
Index Keys: cust_numb subr_numb (Key-Only) (Serial, fragments: ALL)
2) informix.cl: INDEX PATH
(1) Index Name: informix.pk_cs_clse_cust
Index Keys: cust_numb subr_numb (Key-Only) (Serial, fragments: ALL)
Lower Index Filter: (informix.cl.cust_numb = informix.cb.cust_numb AND informix.cl.subr_numb = informix.cb.subr_numb )
NESTED LOOP JOIN
3) informix.cs: INDEX PATH
(1) Index Name: informix.csp_cust_01
Index Keys: cust_numb (Key-Only) (Serial, fragments: ALL)
Lower Index Filter: informix.cs.cust_numb = informix.cb.cust_numb
NESTED LOOP JOIN
select count(*) from cs_subr_pcn_00; -- 14965091
select count(*) from cs_cust; -- 149553382
select count(*) from cs_clse_cust; -- 114596229
But this SQL takes very long time mat be around 40 minutes to execute , sometimes I take cs_cust and cs_clse_cust table data in temp table also but then also it takes long time.
Please suggest to speed up the SQL.
UPDATE STATICS run on all tables.
Thanks
Amit
------------------------------
AMIT PATEL
------------------------------
#Informix