I do not know how mail/notmuch implement tags. But independent of the storagethere is still the tension/relationship between the mailboxes and tags
format, each mail has a supposed unique mailid, much more if you do a table in which each row
corresponds to one and only one mail in the archive.
You can implement tagging with a table with two fields per record: id of mail (on the left) and tagname
(on the right). Mathematically is just a relation. For each tag on the right you have many mails (mailids)
on the left. And for each mail(id) on the left you have many tags on the right.
I suspect that mail/notmuch take a lot of space indexing. If one decides to put the body
in the db, one could also use:
In any case, sql is very powerfull, making for example threading of the mails is just few lines of code.