sql: tracker completed detection