Added index to time column and join after union in queryDeviceAttributeEvents