Searching ticket text directly in the database

We don’t have full text search enabled in our RT instance (4.4.2) for performance reasons, but I have a request to find a specific ticket that has a particular string in the ticket history.

I’m reasonably familar with the SQL tables RT uses but I can’t quite manage to find what I’m looking for.

Which table will store the text of an email that creates a new ticket, and which fields therein are the important ones to look into?

I don’t mind thrashing the server for this one data request so efficiency isn’t an issue, I just need to figure where to direct the ‘%text to match%’ query.

Many thanks,

Simon.

It will be the content on an attachment I believe

I had hoped that this would return what I need but it doesn’t, which makes me think I’m doing something wrong.

select * from attachments where content = ‘%required text%’;


Have you tried LIKE instead of equality? This seemed to work on my test instance of RT5:

select id from Attachments where Content like “%Greeting%”;

I’m embarrassed to say that worked a treat. I really should have known that. :man_facepalming: