spatie / mailcoach-support

Questions and support for Mailcoach
https://mailcoach.app
31 stars 2 forks source link

[Advise] Purging the mailcoach_sends table? #293

Closed electronick86 closed 3 years ago

electronick86 commented 3 years ago

Hello guys!

The bigger Mailcoach instance I have runs since this summer and I just see that the database dumps was quite big. The biggest table of the mailcoach_sends which has ~27Mo rows into it.

Could you telm me whats could be the impact of purging this table with records older than X months? The campaign_opens and campaign_clicks are more 'valuable' as they allow me to segment based on the subscriber behaviour (ex: I some campaign are only sent to subscribers recently subscribed OR that open 1+ email in the last 60 days).

The problem is that if I remove the sends, the associated "clicks" and "opens" will be also deleted.

Do you have any advice with that? Thanks a lot!

riasvdv commented 3 years ago

You could try making the send_id nullable on the opens & clicks tables, and change the on delete cascade to on delete set null, which would allow you to delete the sends without affecting the opens & clicks.

I don't know exactly if this has any consequences in the UI of the app, but I don't think we use the relationship from open to send or click to send anywhere in the code.

Let me know how it goes and if you run into any issues and this could be a change we make by default for v4

freekmurze commented 3 years ago

Closing this as we're not going to handle this in the current version, but feel free to continue the conversion