Optimize tracking query, only the first row is needed