In trying to pull down some stock data after a certain set of criteria is triggered from a database I am getting a slow response mostly based around using dynamic data. I have
Just quickly, you seem to have one too many "OR"
WHERE ( y.exchange = 'NASDAQ CM' OR y.exchange = 'NASDAQ GM' OR ) AND k.t BETWEEN 20150101 AND 20150110
Should be ...
WHERE ( y.exchange = 'NASDAQ CM' OR y.exchange = 'NASDAQ GM' ) AND k.t BETWEEN 20150101 AND 20150110