After un-installing the Subgroup module, the database tables related to Subgroup are not removed from database. I'm using Drupal 11.1.5, Subgroup 3.1.0, and Postgres 16.6.
Steps to reproduce
Ensure you are using Postgres 16 as the back end database
Install Subgroup 3.1.0
Execute composer require drupal/subgroup
Within Drupal, go to Manage --> Extend and install Subgroup. Note that new tables are created in database: group__subgroup_depth, group__subgroup_left, group__subgroup_right, group__subgroup_tree.
Now go back to Manage --> Extend and un-install Subgroup module.
Observe that all 4 Subgroup related tables remain in the database.