Have a strange problem.
A large table (>1tb), select statement of a number of columns return about 30 rows.
Key is a combination of a timestamp and an string id.
I put MAX on those columns and one of the columns causes a time out.
Have isolated this to one particular column.
MIN also gives a timeout but AVG works.
The other columns works ok.
In another database with an identical table (but not that large) it works ok.
Any ideas will be much appreciated
/Peo
select MAX(EP_COMP) AS EP_COMP
From [LOGGEDVALUES_SI]
Where [PAID]='003411'
and [SMPTIME] > '2018-11-20 16:00:00'
and [SMPTIME] < '2018-11-20 17:00:00';
If I change to AVG or SUM it works ok, also with other columns (also float columns)
select MAX(EP_COMP) AS EP_COM
From (
Select ep_comp
From [LOGGEDVALUES_SI]
Where [PAID]='003411' and [SMPTIME] > '2018-11-20 16:00:00' and [SMPTIME] < '2018-11-20 17:00:00') big