Hey there!
I think that the easiest solution for “diff’ing” selected_row_ids is to create a dcc.Store component that holds the ids and update it in the callback. Then you can in principle use it in the callback body to decide whether you should hit the DB or not.
Besides, if your data is relatively small, you can store both the ids and the fetched data in the same store and use selected_row_ids to filter which one of the elements in the store should be displayed in the tabs. In other words, if user selects a row, unselect it and select it again, the data is requested only once in the DB. For larger data, one option is to do server-side caching as discussed in this very nice post