I have a visualforce page with a custom save method in which I'm saving multiple objects. I want to save only those objects which got modified. Currently I'm doing an upsert on all objects when save happens. How do I detect the dirty objects before saving?
I believe that what you are looking for is something analogous to Postgresql's suppress_redundant_updates_trigger().
Unfortunately, that doesn't exist in Salesforce. The only way to prevent updates on unmodified records is to control which objects you update in your apex code.