Deleting user data from the database I'm using Craft 3.6.4.1 and I need to delete a whole tranche of users from the database (that has derived from another Craft instance).
I've been deleting by hand via the CMS but note that loads of user related rows remain in the database:

The CMS is reporting only the 4 users which I want to retain, but craft_users still has 10,706 rows in it.

From which tables should I clean out rows that pertain to users I want to delete?
I note the additional following tables which seem relevant in ways I'm unsure of:
craft_usergroups_users
craft_userpermissions
craft_userpermissions_usergroups
craft_userpermissions_users
craft_userpreferences
After deleting the users from the UI they are only soft-deleted. If you look at the user id and find the matching element in your elements table, you will see that this element has a populated dateDeleted.
Run garbage collection (./craft gc) to clean up and completely remove everything.