Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Email Storage in Database #3539

Open
milescalabresi opened this issue Jun 20, 2022 · 1 comment · May be fixed by #3759
Open

Improve Email Storage in Database #3539

milescalabresi opened this issue Jun 20, 2022 · 1 comment · May be fixed by #3759

Comments

@milescalabresi
Copy link
Contributor

Storing each individual's email text is very space-inefficient that balloons our DBs. For example, as of creating this ticket, email text occupies approximately 90% of Stanford's database and 95% of Yale's. It would be good to refactor our database setup to store the often-repeated text of emails in a more compressed format and link to the individual information that populates the tags within individual emails in a separate column or table.

Suggestion:

  • one table for each batch of emails that gets sent; that table contains the template for the email, the recipients, and the other current metadata (timestamps, etc.)
  • separate table whose columns are a foreign key to the previous table, each recipient's userid, and tag values for each of the tags available to admins. The fields would be the values of the tags for the recipient at the time the email is sent.

If we want to recreate the textofemail view for admins, we can do so from these tables, or we can simply show the metadata list in a searchable format, which should answer most questions admins would usually have.

Keywords: e-mail e-mails db databases schema

@milescalabresi
Copy link
Contributor Author

Additional points of consideration from conversation with @willgearty

  • the original purpose of doing things this way is to conserve resources at send-time
  • when this schema was designed, we sent our own emails; now we use SendGrid, which might enable other enhancements (assuming we anticipate using external services long-term)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment