Add a Documentation about how the tables are connected to the documentation for developers.
This image explains more than 1000 words:
(NOTE: this schema is outdated, I provided a new image in the comment below)

Created with phpmyadmin and a mysql version of the database
nice! Are you running synapse with a mysql backend? I would prefer mysql to postgresql myself but haven't found much out there about people using synapse with mysql.
I am not running synapse with that mysql database, I just converted the sqlite.db, so I can use mysql-tools to analyze the db structure.
I guess, there would be some more work to be done, to set up the mysql-db right, cause the types are a bit different and I just bulk-changed the keys to nearly fitting types.
and also the keys, I added by hand like
KEY (`room_id`),
KEY (`event_id`)
For info: here I posted a structure dump of the complete PostgreSQL database: https://gist.github.com/rubo77/29a18ccc04800dbd6fbf946b0118b2fd#file-postgresql-database-dump-sql
Any explanation on tables and fields?
we're not likely to invest time in documenting the database schema and then maintaining it.
If you don't resolve this issue, maybe i can?
can you pls reopen it?
Is there a more complete database visualisation somewhere, by now?
there's postgresql_autodoc
@ptman: autodoc seems interesting. I tried that out. Here is the result: https://riot.eclabs.de/synapse.html
Quite useful. But it seems like there are a lot of foreign keys, that are not defined in the database, (or autodoc cannot retreive the connection automatically).
I.g. event_to_state_groups has two foreign keys, that are not listed.
I tried that out. Here is the result: https://riot.eclabs.de/synapse.html
404's, maybe you can upload it directly to github?
I repaired the link, but here is the source:
https://gist.github.com/rubo77/c47cd669ad46f9cb16784277069be0ba
I started an export with pgModeler. It would be great to have a list of all foreign-key constraints, to create a local model with all relations. This will result in a graphic like this:

I hope, we can collect an SQL commands list, to add the foreign keys. I started a better explanation inthis RFC: https://github.com/matrix-org/synapse/pull/6615
Imgine my surprise that there are no foreign keys. Is this a deliberate choice?
I added some more important tables and recreated the graphic 4 comments below
I added some more important tables:
I've had a quick look at this. It seems to show exactly two things:
room_id column in the rooms table. No nobel prizes on offer for this discovery.name column in the users table. This is simply wrong since it omits the fact that those tables also include information for users on other servers, whereas users only records local users.user_id column, which relates to the name column in all users tables from all participating homeserversSo how would you visualize this in a diagram?
btw.:
@richvdh explained very well the concepts of the room states here in the synapse Wiki
So how would you visualize this in a diagram?
I don't know. I'm not the one arguing that we need a visualisation of the database.

I added "all participating servers"
I added "all participating servers"
I guess event_json is also relevant to include?
Most helpful comment
I added "all participating servers"