taxonomy_select_nodes returns all the nodes tagged with a given tid. This function checks the taxonomy_index table.
That table stores the tid and the nids on which it is tagged.
Let's say I have some custom entities with terms on them AND a user entity with terms on it, how do I get all the entities tagged with a given tid? Can this be done in 1 query/function?