Is it a good practice to remember checkbox selection across multiple pages in a grid?

Suppose I need to select multiple items across pages and then apply an action (click of a button) on it.

Is it a good idea?

If user wants to know what he/she has selected then can I help him by allowing sorting on the checkbox row? Please let me know if there are any guidelines on this.

Note: This isn't really about user-expectation. I checked this question as well but couldn't understand how to make selection possible.