I was running this tool today in a hope to deflate the emailmessage table.
Is this output normal?
Raw email tool
Re: Raw email tool
My guess is that you have a lot of email messages that do not have a matching email address. If that's the case, this query would return a high number:
SELECT COUNT(*)
FROM emailmessage m
LEFT JOIN emailaddress a ON a.EmailUsername=m.RecipientAddress
WHERE a.EmailAddressNum IS NULL
SELECT COUNT(*)
FROM emailmessage m
LEFT JOIN emailaddress a ON a.EmailUsername=m.RecipientAddress
WHERE a.EmailAddressNum IS NULL
-
- Posts: 177
- Joined: Fri Oct 14, 2011 3:31 pm
Re: Raw email tool
The number returned by the query is 16,132cmcgehee wrote:My guess is that you have a lot of email messages that do not have a matching email address. If that's the case, this query would return a high number:
SELECT COUNT(*)
FROM emailmessage m
LEFT JOIN emailaddress a ON a.EmailUsername=m.RecipientAddress
WHERE a.EmailAddressNum IS NULL
It seems high.
Does that mean all those emails are not attached to the patient's charts. Like in case where the patient would list one or no email on the forms, and have a communication using another email address, thus OD does not know to whom this email conversation belongs?
I am trying to figure out what to do with those emails. The table emailmessage is huge. Maybe the solution on how to get raw email tool work on all of those messages will also give me a decent deflation of the emailmessage table?
Re: Raw email tool
Those emails will still show up on the patients' charts. It's just that OD won't be able to link those emails to a row in the email address for the sender. From what I can think of, I don't think it will cause an noticeable problem. What is your motivation for deflating the email message table? Are queries related to emails running slowly?
-
- Posts: 177
- Joined: Fri Oct 14, 2011 3:31 pm
Re: Raw email tool
Just the time that it takes the OD to update, well, maybe megabytes too, each backup is close to 0.5Gb (archived version).
Re: Raw email tool
That makes sense. My guess is that the rest of the rows in your emailmessage table are emails that don't have anything in the RawEmailIn column. The raw email tool is only meant to clean up that column; it doesn't clear out the BodyText column because you would be losing communication data if it did.