"Segmentation fault: 11" when trying to vacuum Apple Mail index
‘Segmentation fault: 11’ almost always means the process ran out of RAM whilst trying to perform some operation/calculation. This would corroborate with your slow Mail due to the size of the database you're trying to process (or it's just corrupted in such a way).

It may also be worth checking your free disk space, since the VACUUM command specifically requires plenty of space:


  The VACUUM command works by copying the contents of the database into a temporary database file and then overwriting the original with the contents of the temporary file. […] as much as twice the size of the original database file is required in free disk space.


https://sqlite.org/lang_vacuum.html