Hello Experts,
I have a problem about Execution Plan of a SQL with binding variables bellows:
SQL1: Run very fast with plan on attached file
SELECT count(*)
FROM JHMATCH m
INNER JOIN VHBORDER bo
ON m.BORDERID = bo.ORDERID
INNER JOIN VCRPTTRADINGACCVN ta
ON bo.CLIENTID = ta.CLIENTID
AND bo.TRADINGACCSEQ = ta.TRADINGACCSEQ
and m.VALUEDATE >= '2019-06-03'
AND m.VALUEDATE <= '2019-06-30'
SQL2: Run very slow with plan on attached file
SELECT count(*)
FROM JHMATCH m
INNER JOIN VHBORDER bo
ON m.BORDERID = bo.ORDERID
INNER JOIN VCRPTTRADINGACCVN ta
ON bo.CLIENTID = ta.CLIENTID
AND bo.TRADINGACCSEQ = ta.TRADINGACCSEQ
and m.VALUEDATE >= '2019-06-02'
AND m.VALUEDATE <= '2019-06-30'
I executed the Runstats to gather statistics on tables JHMATCH, THBORDER and ran the SQL1, 2 againt but got the same problem. Please help me to tuning SQL2.
Many thanks,
Bgs, Vinhpv.