Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

1 Answer
1

You can run EXPLAIN ANALYZE inside a transaction and then roll back the transaction. This will write to the table and indexes, but the writes will not become visible to other users, other then through locks and side-channels (e.g. table and index bloat).

If you already have a script which runs the updates you want, adding BEGIN and ROLLBACK (or changing COMMIT to ROLLBACK if your script already does explicit transactions) should be incredibly trivial; so it is not clear what you are asking.

But you should clone your database to a test environment, and then run your tests in the test environment in a realistic manner. Running aborted updates in a tight loop might not have the same performance as running committed updates in a tight loop.