I have this query inside an automation where it is executed with many other queries that are working fine, but when I run this one, the following error appears: query failed: timeout. How could I improve it so that it takes less time to run? I must say that testing it in isolation in Query studio works fine. Thanks in advance!
SELECT x.[AccountID], x.[OYBAccountID], x.[JobID], x.[ListID], x.[BatchID], x.[SubscriberID], x.[SubscriberKey], x.[EventDate], x.[Domain], x.[TriggererSendDefinitionObjectID], x.[TriggeredSendCustomerKey] FROM ( SELECT [AccountID], [OYBAccountID], [JobID], [ListID], [BatchID], [SubscriberID], [SubscriberKey], [EventDate], [Domain], [TriggererSendDefinitionObjectID], [TriggeredSendCustomerKey], ROW_NUMBER() OVER ( PARTITION BY AccountID, JobID, ListID, BatchID, SubscriberID, SubscriberKey, EventDate, Domain ORDER BY EventDate ASC ) as ranking FROM _Sent ) x WHERE ranking = 1