HI, im having trouble trying to optimize the following query for sql server 2005. Does anyone know how could i improve it. Each one of the tables used there have about 40 million rows each. I've tried my best trying to optimize it but i manage to do the exact opposite.
Thanks
SELECT
cos
, SIN
FROM
ConSisHis2005
union all
SELECT
cos
, SIN
FROM
ConSisHis2006
union all
SELECT
cos
, SIN
FROM
ConSisHis2007
UNION ALL
SELECT
cos
, SIN
FROM
ConSisHis2008
Maybe i should have said something else about the schema, all the tables used here are historical tables, they are not referenced to any other table. And theres already an index for cos and SIN. I was just wondering if there was any other way to optimize the query... as you can imagine 160millon records are hard to get :s