Hi all, just to reply that this worked just fine, the insert took about 1h15m on our test BD, which is about 750k tickets and 220 Gb.
As the SQL code got a bit mangled on the first post, I’m posting it here again for clarity. Our database is called rt3, and since we have many tickets from external emails , I’ve removed the filter for the external domains.
SELECT Users.Name, Users.id, Tickets.id, Queues.Name, Filename,Attachments.ContentType, Attachments.Created, Size, TimeWorked
FROM Attachments,AttSize, Transactions, Tickets, Users, Queues WHERE
AttId=Attachments.id AND AttSize.Size > 1500000 /* the query shows attachments larger than 1.5 MB */
AND Transactions.id = TransactionId
AND Tickets.EffectiveId = Transactions.ObjectId
AND Transactions.ObjectType = 'RT::Ticket’
AND Users.id = Attachments.Creator
AND TimeWorked = 0
AND Queues.id = Tickets.Queue
order by AttSize.Size DESC