When I run the JDBC query with the date equal it runs extremely fast but when we change the where clause to greater than/less than it is extremely slow. I've included the two queries. How do we get the greater than/less than to run just as fast as the equal?
SELECT OEEL.orderno, OEEL.invoicedt
FROM PUB.OEEL AS OEEL
INNER JOIN PUB.OEEH AS OEEH ON OEEL.cono = OEEH.cono AND OEEL.orderno = OEEH.orderno AND OEEL.ordersuf = OEEH.ordersuf
WHERE oeel.cono = 1 AND oeel.statustype IN ('I','i') AND oeel.whse = 'IA' AND OEEL.invoicedt = '2015-10-01'
AND oeel.specnstype IN ('','n','N','s','S') AND OEEH.stagecd IN ('4', '5')
VS.
SELECT OEEL.orderno, OEEL.invoicedt
FROM PUB.OEEL AS OEEL
INNER JOIN PUB.OEEH AS OEEH ON OEEL.cono = OEEH.cono AND OEEL.orderno = OEEH.orderno AND OEEL.ordersuf = OEEH.ordersuf
WHERE oeel.cono = 1 AND oeel.statustype IN ('I','i') AND oeel.whse = 'IA' AND OEEL.invoicedt >= '2015-10-01' AND OEEL.invoicedt <= '2015-10-01' AND oeel.specnstype IN ('','n','N','s','S') AND OEEH.stagecd IN ('4', '5')
SELECT OEEL.orderno, OEEL.invoicedt
FROM PUB.OEEL AS OEEL
INNER JOIN PUB.OEEH AS OEEH ON OEEL.cono = OEEH.cono AND OEEL.orderno = OEEH.orderno AND OEEL.ordersuf = OEEH.ordersuf
WHERE oeel.cono = 1 AND oeel.statustype IN ('I','i') AND oeel.whse = 'IA' AND OEEL.invoicedt = '2015-10-01'
AND oeel.specnstype IN ('','n','N','s','S') AND OEEH.stagecd IN ('4', '5')
VS.
SELECT OEEL.orderno, OEEL.invoicedt
FROM PUB.OEEL AS OEEL
INNER JOIN PUB.OEEH AS OEEH ON OEEL.cono = OEEH.cono AND OEEL.orderno = OEEH.orderno AND OEEL.ordersuf = OEEH.ordersuf
WHERE oeel.cono = 1 AND oeel.statustype IN ('I','i') AND oeel.whse = 'IA' AND OEEL.invoicedt >= '2015-10-01' AND OEEL.invoicedt <= '2015-10-01' AND oeel.specnstype IN ('','n','N','s','S') AND OEEH.stagecd IN ('4', '5')